Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
google
GitHub Repository: google/crosvm
Path: blob/main/base/src/notifiers.rs
5394 views
1
// Copyright 2022 The ChromiumOS Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
use crate::descriptor::AsRawDescriptor;
6
7
pub trait ReadNotifier {
8
/// Gets a descriptor that can be used in EventContext to wait for events to be available (e.g.
9
/// to avoid receive_events blocking).
10
fn get_read_notifier(&self) -> &dyn AsRawDescriptor;
11
}
12
13
impl ReadNotifier for std::fs::File {
14
fn get_read_notifier(&self) -> &dyn AsRawDescriptor {
15
self
16
}
17
}
18
19
pub trait CloseNotifier {
20
/// Gets a descriptor that can be used in EventContext to wait for the closed event.
21
fn get_close_notifier(&self) -> &dyn AsRawDescriptor;
22
}
23
24