blob: 9909e1c03c620e6ffecc4ea1e99dd1d8a9370c18 [file] [log] [blame]
// Copyright 2022 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use crate::descriptor::AsRawDescriptor;
pub trait ReadNotifier {
/// Gets a descriptor that can be used in EventContext to wait for events to be available (e.g.
/// to avoid receive_events blocking).
fn get_read_notifier(&self) -> &dyn AsRawDescriptor;
}
impl ReadNotifier for std::fs::File {
fn get_read_notifier(&self) -> &dyn AsRawDescriptor {
self
}
}
pub trait CloseNotifier {
/// Gets a descriptor that can be used in EventContext to wait for the closed event.
fn get_close_notifier(&self) -> &dyn AsRawDescriptor;
}