pub struct VmiTerminationHandler<Handler> { /* private fields */ }Expand description
Handler that interrupts another handler at a deadline or once a termination flag is set.
VmiHandlerExt adds it to any handler, for example with
VmiHandlerExt::with_deadline. The wrapped handler is interrupted
through VmiHandler::handle_interrupted, as if by a signal.
If the guest causes no events, the event loop wakes up only once per wait timeout. The deadline, the termination flag and the termination timeout can then take effect up to one wait timeout late.
The output is None if the event loop ended without the output of the
wrapped handler, after it was interrupted.
Implementations§
Source§impl<Handler> VmiTerminationHandler<Handler>
impl<Handler> VmiTerminationHandler<Handler>
Sourcepub fn with_deadline(self, deadline: Instant) -> Self
pub fn with_deadline(self, deadline: Instant) -> Self
Sets the time at which the handler is interrupted.
Sourcepub fn with_termination_flag(self, termination_flag: Arc<AtomicBool>) -> Self
pub fn with_termination_flag(self, termination_flag: Arc<AtomicBool>) -> Self
Installs a flag that interrupts the handler once it becomes true.
Sourcepub fn with_termination_timeout(self, termination_timeout: Duration) -> Self
pub fn with_termination_timeout(self, termination_timeout: Duration) -> Self
Sets the time the handler has to finish once interrupted, by a signal, the deadline or the termination flag. When the time runs out, the event loop ends without the output of the handler.
Trait Implementations§
Source§impl<Os, Handler> VmiHandler<Os> for VmiTerminationHandler<Handler>where
Os: VmiOs,
Handler: VmiHandler<Os>,
impl<Os, Handler> VmiHandler<Os> for VmiTerminationHandler<Handler>where
Os: VmiOs,
Handler: VmiHandler<Os>,
Source§fn handle_event(
&mut self,
vmi: VmiContext<'_, Os>,
) -> VmiEventResponse<Os::Architecture>
fn handle_event( &mut self, vmi: VmiContext<'_, Os>, ) -> VmiEventResponse<Os::Architecture>
Source§fn handle_timeout(&mut self, session: &VmiSession<'_, Os>)
fn handle_timeout(&mut self, session: &VmiSession<'_, Os>)
Source§fn handle_interrupted(
&mut self,
session: &VmiSession<'_, Os>,
) -> ControlFlow<()>
fn handle_interrupted( &mut self, session: &VmiSession<'_, Os>, ) -> ControlFlow<()>
Source§fn cleanup(&mut self, session: &VmiSession<'_, Os>)
fn cleanup(&mut self, session: &VmiSession<'_, Os>)
Auto Trait Implementations§
impl<Handler> Freeze for VmiTerminationHandler<Handler>where
Handler: Freeze,
impl<Handler> RefUnwindSafe for VmiTerminationHandler<Handler>where
Handler: RefUnwindSafe,
impl<Handler> Send for VmiTerminationHandler<Handler>where
Handler: Send,
impl<Handler> Sync for VmiTerminationHandler<Handler>where
Handler: Sync,
impl<Handler> Unpin for VmiTerminationHandler<Handler>where
Handler: Unpin,
impl<Handler> UnsafeUnpin for VmiTerminationHandler<Handler>where
Handler: UnsafeUnpin,
impl<Handler> UnwindSafe for VmiTerminationHandler<Handler>where
Handler: UnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<Os, Handler> VmiHandlerExt<Os> for Handlerwhere
Os: VmiOs,
Handler: VmiHandler<Os>,
impl<Os, Handler> VmiHandlerExt<Os> for Handlerwhere
Os: VmiOs,
Handler: VmiHandler<Os>,
Source§fn with_deadline(self, deadline: Instant) -> VmiTerminationHandler<Self>
fn with_deadline(self, deadline: Instant) -> VmiTerminationHandler<Self>
VmiTerminationHandler that interrupts it
at deadline.Source§fn with_termination_flag(
self,
termination_flag: Arc<AtomicBool>,
) -> VmiTerminationHandler<Self>
fn with_termination_flag( self, termination_flag: Arc<AtomicBool>, ) -> VmiTerminationHandler<Self>
VmiTerminationHandler with a flag that
interrupts it once the flag becomes true.Source§fn with_termination_timeout(
self,
termination_timeout: Duration,
) -> VmiTerminationHandler<Self>
fn with_termination_timeout( self, termination_timeout: Duration, ) -> VmiTerminationHandler<Self>
VmiTerminationHandler that gives it
termination_timeout to finish once interrupted.