pub struct SignalEvent {
pub signal: Signal,
/* private fields */
}Expand description
Event indicating that Tor received a signal.
This event is emitted when Tor receives a signal, either from the
operating system or via the control protocol’s SIGNAL command.
§Signals
Common signals include:
Signal::Newnym- Request new circuitsSignal::Reload- Reload configurationSignal::Shutdown- Graceful shutdownSignal::Halt- Immediate shutdown
§Example
ⓘ
use stem_rs::events::SignalEvent;
use stem_rs::Signal;
fn handle_signal(event: &SignalEvent) {
match event.signal {
Signal::Newnym => println!("New identity requested"),
Signal::Shutdown => println!("Tor is shutting down"),
_ => println!("Received signal: {:?}", event.signal),
}
}§See Also
Signal- Signal types
Fields§
§signal: SignalThe signal that was received.
Implementations§
Trait Implementations§
Source§impl Clone for SignalEvent
impl Clone for SignalEvent
Source§fn clone(&self) -> SignalEvent
fn clone(&self) -> SignalEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SignalEvent
impl Debug for SignalEvent
Source§impl Event for SignalEvent
impl Event for SignalEvent
Source§fn event_type(&self) -> EventType
fn event_type(&self) -> EventType
Returns the type of this event. Read more
Source§fn raw_content(&self) -> &str
fn raw_content(&self) -> &str
Returns the raw, unparsed content of the event. Read more
Source§fn arrived_at(&self) -> Instant
fn arrived_at(&self) -> Instant
Returns the instant when this event was received. Read more
Auto Trait Implementations§
impl Freeze for SignalEvent
impl RefUnwindSafe for SignalEvent
impl Send for SignalEvent
impl Sync for SignalEvent
impl Unpin for SignalEvent
impl UnwindSafe for SignalEvent
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