pub struct Interrupt { /* private fields */ }Expand description
An object representing an interrupt-like signal to notify the guest of device activity.
This is generally an edge-triggered interrupt, but it could also be a synic event or similar notification.
The interrupt can be backed by a [pal_event::Event] or a function. In the
former case, the Interrupt can be sent across a mesh channel to remote
processes.
Implementations§
Source§impl Interrupt
impl Interrupt
Sourcepub fn null() -> Self
pub fn null() -> Self
An interrupt that does nothing.
Note that Self::event will still return a valid event, which will be
lazily created on demand. This allows the interrupt to be used with APIs
that require an event, without actually delivering any notifications.
Sourcepub fn from_event(event: Event) -> Self
pub fn from_event(event: Event) -> Self
Creates an interrupt from an event.
The event will be signaled when Self::deliver is called.
Sourcepub fn from_fn<F>(f: F) -> Self
pub fn from_fn<F>(f: F) -> Self
Creates an interrupt from a function.
The function will be called when Self::deliver is called. This type of
interrupt cannot be sent to a remote process.
Sourcepub fn from_target(target: impl InterruptTarget + 'static) -> Self
pub fn from_target(target: impl InterruptTarget + 'static) -> Self
Creates an interrupt from an InterruptTarget implementation.
Sourcepub fn event(&self) -> Option<&Event>
pub fn event(&self) -> Option<&Event>
Gets a reference to the backing event, if there is one.
This will attempt to lazily create the event via the target if one has not already been cached.
Sourcepub fn event_or_proxy(
&self,
driver: &impl SpawnDriver,
) -> Result<(Event, Option<EventProxy>)>
pub fn event_or_proxy( &self, driver: &impl SpawnDriver, ) -> Result<(Event, Option<EventProxy>)>
Returns an event that, when signaled, will deliver this interrupt.
If Self::event returns an event, returns a clone of it and no
proxy is needed. Otherwise, creates an EventProxy that spawns an
async task to bridge a new event to Interrupt::deliver. The caller
must keep the returned Option<EventProxy> alive for as long as the
event is in use.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Interrupt
impl !RefUnwindSafe for Interrupt
impl Send for Interrupt
impl Sync for Interrupt
impl Unpin for Interrupt
impl UnsafeUnpin for Interrupt
impl !UnwindSafe for Interrupt
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> MeshField for T
impl<T> MeshField for T
§impl<T> MeshPayload for T
impl<T> MeshPayload for T
§impl<T> SerializeMessage for Twhere
T: 'static + MeshPayload + Send,
impl<T> SerializeMessage for Twhere
T: 'static + MeshPayload + Send,
§fn compute_message_size(&mut self, sizer: MessageSizer<'_>)
fn compute_message_size(&mut self, sizer: MessageSizer<'_>)
MessageEncode::compute_message_size].§fn write_message(self, writer: MessageWriter<'_, '_, Resource>)
fn write_message(self, writer: MessageWriter<'_, '_, Resource>)
MessageEncode::write_message].