pub enum MaybeWrappedEvent<T> {
Original(T),
Wrapped {
event: Event,
wrapper: WrappedEvent,
},
}
Expand description
Represents an object that either has an OS event or is wrapped using one.
Variants§
Implementations§
Source§impl<T: OsEventBacked + Send + 'static> MaybeWrappedEvent<T>
impl<T: OsEventBacked + Send + 'static> MaybeWrappedEvent<T>
Sourcepub fn new(driver: &impl SpawnDriver, original: T) -> Result<Self>
pub fn new(driver: &impl SpawnDriver, original: T) -> Result<Self>
Creates a new MaybeWrappedEvent
. If the original object has an OS event, it is used
directly. Otherwise, a new OS event is created that can be used to signal the original
object.
Sourcepub fn event(&self) -> &Event
pub fn event(&self) -> &Event
Gets the OS event associated with this object. This can be either the original event or the wrapped event.
Sourcepub fn into_wrapped(self) -> Option<WrappedEvent>
pub fn into_wrapped(self) -> Option<WrappedEvent>
Extracts the WrappedEvent
, if one was created.
Auto Trait Implementations§
impl<T> Freeze for MaybeWrappedEvent<T>where
T: Freeze,
impl<T> RefUnwindSafe for MaybeWrappedEvent<T>where
T: RefUnwindSafe,
impl<T> Send for MaybeWrappedEvent<T>where
T: Send,
impl<T> Sync for MaybeWrappedEvent<T>where
T: Sync,
impl<T> Unpin for MaybeWrappedEvent<T>where
T: Unpin,
impl<T> UnwindSafe for MaybeWrappedEvent<T>where
T: UnwindSafe,
Blanket Implementations§
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