pub struct ConfChangedEvent {
pub changed: HashMap<String, Vec<String>>,
pub unset: Vec<String>,
/* private fields */
}Expand description
Event indicating that Tor’s configuration has changed.
This event is emitted when configuration options are modified, either
through SETCONF commands or by reloading the configuration file.
§Changed vs Unset
changed- Options that were set to new valuesunset- Options that were reset to defaults
Options can have multiple values (e.g., ExitPolicy), so changed
maps option names to a list of values.
§Example
ⓘ
use stem_rs::events::ConfChangedEvent;
fn handle_conf_changed(event: &ConfChangedEvent) {
for (option, values) in &event.changed {
println!("Changed: {} = {:?}", option, values);
}
for option in &event.unset {
println!("Unset: {}", option);
}
}Fields§
§changed: HashMap<String, Vec<String>>Options that were changed, mapped to their new values.
unset: Vec<String>Options that were unset (reset to defaults).
Implementations§
Source§impl ConfChangedEvent
impl ConfChangedEvent
Sourcepub fn parse(lines: &[String]) -> Result<Self, Error>
pub fn parse(lines: &[String]) -> Result<Self, Error>
Parses a configuration changed event from multi-line content.
§Arguments
lines- The event content lines (excluding header/footer)
§Event Format
Each line is either:
Key=Value- Option set to a valueKey- Option unset
§Errors
This method currently does not return errors but returns Result
for API consistency.
Trait Implementations§
Source§impl Clone for ConfChangedEvent
impl Clone for ConfChangedEvent
Source§fn clone(&self) -> ConfChangedEvent
fn clone(&self) -> ConfChangedEvent
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 ConfChangedEvent
impl Debug for ConfChangedEvent
Source§impl Event for ConfChangedEvent
impl Event for ConfChangedEvent
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 ConfChangedEvent
impl RefUnwindSafe for ConfChangedEvent
impl Send for ConfChangedEvent
impl Sync for ConfChangedEvent
impl Unpin for ConfChangedEvent
impl UnwindSafe for ConfChangedEvent
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