pub struct NetworkLivenessEvent {
pub status: String,
/* private fields */
}Expand description
Event indicating network connectivity status.
This event is emitted when Tor’s view of network liveness changes. It indicates whether Tor believes the network is reachable.
§Status Values
"UP"- Network is reachable"DOWN"- Network is unreachable
§Example
ⓘ
use stem_rs::events::NetworkLivenessEvent;
fn handle_liveness(event: &NetworkLivenessEvent) {
match event.status.as_str() {
"UP" => println!("Network is up"),
"DOWN" => println!("Network is down"),
_ => println!("Unknown network status: {}", event.status),
}
}Fields§
§status: StringNetwork status (“UP” or “DOWN”).
Implementations§
Trait Implementations§
Source§impl Clone for NetworkLivenessEvent
impl Clone for NetworkLivenessEvent
Source§fn clone(&self) -> NetworkLivenessEvent
fn clone(&self) -> NetworkLivenessEvent
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 NetworkLivenessEvent
impl Debug for NetworkLivenessEvent
Source§impl Event for NetworkLivenessEvent
impl Event for NetworkLivenessEvent
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 NetworkLivenessEvent
impl RefUnwindSafe for NetworkLivenessEvent
impl Send for NetworkLivenessEvent
impl Sync for NetworkLivenessEvent
impl Unpin for NetworkLivenessEvent
impl UnwindSafe for NetworkLivenessEvent
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