pub(crate) struct PlatformEvent {
event_handle: SafeDescriptor,
}
Expand description
A safe wrapper around a Linux eventfd (man 2 eventfd).
An eventfd is useful because it is sendable across processes and can be used for signaling in and out of the KVM API. They can also be polled like any other file descriptor.
Fields§
§event_handle: SafeDescriptor
Implementations§
source§impl PlatformEvent
impl PlatformEvent
sourcepub fn new() -> Result<PlatformEvent>
pub fn new() -> Result<PlatformEvent>
Creates a new blocking eventfd with an initial value of 0.
sourcepub fn write_count(&self, v: u64) -> Result<()>
pub fn write_count(&self, v: u64) -> Result<()>
See EventExt::write_count
.
sourcepub fn read_count(&self) -> Result<u64>
pub fn read_count(&self) -> Result<u64>
See EventExt::read_count
.
sourcepub fn wait_timeout(&self, timeout: Duration) -> Result<EventWaitResult>
pub fn wait_timeout(&self, timeout: Duration) -> Result<EventWaitResult>
See Event::wait_timeout
.
sourcepub fn try_clone(&self) -> Result<PlatformEvent>
pub fn try_clone(&self) -> Result<PlatformEvent>
Clones this eventfd, internally creating a new file descriptor. The new eventfd will share the same underlying count within the kernel.
Trait Implementations§
source§impl AsRawDescriptor for PlatformEvent
impl AsRawDescriptor for PlatformEvent
source§fn as_raw_descriptor(&self) -> RawDescriptor
fn as_raw_descriptor(&self) -> RawDescriptor
Returns the underlying raw descriptor. Read more
source§impl Debug for PlatformEvent
impl Debug for PlatformEvent
source§impl<'de> Deserialize<'de> for PlatformEvent
impl<'de> Deserialize<'de> for PlatformEvent
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<PlatformEvent> for SafeDescriptor
impl From<PlatformEvent> for SafeDescriptor
source§fn from(evt: PlatformEvent) -> Self
fn from(evt: PlatformEvent) -> Self
Converts to this type from the input type.
source§impl From<SafeDescriptor> for PlatformEvent
impl From<SafeDescriptor> for PlatformEvent
source§fn from(sd: SafeDescriptor) -> Self
fn from(sd: SafeDescriptor) -> Self
Converts to this type from the input type.
source§impl FromRawDescriptor for PlatformEvent
impl FromRawDescriptor for PlatformEvent
source§unsafe fn from_raw_descriptor(descriptor: RawDescriptor) -> Self
unsafe fn from_raw_descriptor(descriptor: RawDescriptor) -> Self
Safety Read more
source§impl IntoRawDescriptor for PlatformEvent
impl IntoRawDescriptor for PlatformEvent
fn into_raw_descriptor(self) -> RawDescriptor
source§impl PartialEq for PlatformEvent
impl PartialEq for PlatformEvent
source§fn eq(&self, other: &PlatformEvent) -> bool
fn eq(&self, other: &PlatformEvent) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for PlatformEvent
impl Serialize for PlatformEvent
impl Eq for PlatformEvent
impl StructuralPartialEq for PlatformEvent
Auto Trait Implementations§
impl RefUnwindSafe for PlatformEvent
impl Send for PlatformEvent
impl Sync for PlatformEvent
impl Unpin for PlatformEvent
impl UnwindSafe for PlatformEvent
Blanket Implementations§
source§impl<T> AsRawDescriptors for Twhere
T: AsRawDescriptor,
impl<T> AsRawDescriptors for Twhere
T: AsRawDescriptor,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more