pub struct TrapHandlerConfig { /* private fields */ }Expand description
Configuration for trap handlers in the shell.
Implementations§
Source§impl TrapHandlerConfig
impl TrapHandlerConfig
Sourcepub fn iter_handlers(&self) -> impl Iterator<Item = (TrapSignal, &TrapHandler)>
pub fn iter_handlers(&self) -> impl Iterator<Item = (TrapSignal, &TrapHandler)>
Iterates over the registered handlers for trap signals.
Sourcepub fn get_handler(&self, signal_type: TrapSignal) -> Option<&TrapHandler>
pub fn get_handler(&self, signal_type: TrapSignal) -> Option<&TrapHandler>
Tries to find the handler associated with the given signal.
§Arguments
signal_type- The type of signal to get the handler for.
Sourcepub fn handles(&self, signal_type: TrapSignal) -> bool
pub fn handles(&self, signal_type: TrapSignal) -> bool
Returns whether a handler is registered for the given signal.
Sourcepub fn register_handler(
&mut self,
signal_type: TrapSignal,
command: String,
source_info: SourceInfo,
)
pub fn register_handler( &mut self, signal_type: TrapSignal, command: String, source_info: SourceInfo, )
Registers a handler for a trap signal.
§Arguments
signal_type- The type of signal to register a handler for.command- The command to execute when the signal is trapped.source_info- The source info for where the trap handler was defined.
Sourcepub fn remove_handlers(&mut self, signal_type: TrapSignal)
pub fn remove_handlers(&mut self, signal_type: TrapSignal)
Removes handlers for a trap signal.
§Arguments
signal_type- The type of signal to remove handlers for.
Trait Implementations§
Source§impl Clone for TrapHandlerConfig
impl Clone for TrapHandlerConfig
Source§impl Default for TrapHandlerConfig
impl Default for TrapHandlerConfig
Source§impl<'de> Deserialize<'de> for TrapHandlerConfig
Available on crate feature serde only.
impl<'de> Deserialize<'de> for TrapHandlerConfig
Available on crate feature
serde only.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
Auto Trait Implementations§
impl Freeze for TrapHandlerConfig
impl RefUnwindSafe for TrapHandlerConfig
impl Send for TrapHandlerConfig
impl Sync for TrapHandlerConfig
impl Unpin for TrapHandlerConfig
impl UnsafeUnpin for TrapHandlerConfig
impl UnwindSafe for TrapHandlerConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more