pub struct CircuitBandwidthEvent {
pub id: CircuitId,
pub read: u64,
pub written: u64,
pub time: Option<DateTime<Utc>>,
/* private fields */
}Expand description
Event providing bandwidth information for a specific circuit.
Unlike BandwidthEvent which provides aggregate bandwidth, this event
tracks bandwidth usage per circuit. This is useful for monitoring
individual connections or identifying high-bandwidth circuits.
§Example
ⓘ
use stem_rs::events::CircuitBandwidthEvent;
fn handle_circ_bw(event: &CircuitBandwidthEvent) {
println!("Circuit {} bandwidth: {} read, {} written",
event.id, event.read, event.written);
if let Some(time) = &event.time {
println!(" at {}", time);
}
}§See Also
BandwidthEvent- Aggregate bandwidthConnectionBandwidthEvent- Per-connection bandwidth
Fields§
§id: CircuitIdCircuit identifier.
read: u64Bytes read on this circuit.
written: u64Bytes written on this circuit.
time: Option<DateTime<Utc>>Timestamp of the measurement (if available).
Implementations§
Source§impl CircuitBandwidthEvent
impl CircuitBandwidthEvent
Sourcepub fn parse(content: &str) -> Result<Self, Error>
pub fn parse(content: &str) -> Result<Self, Error>
Parses a circuit bandwidth event from raw control protocol content.
§Arguments
content- The event content after the event type
§Event Format
ID=CircuitID READ=bytes WRITTEN=bytes [TIME=timestamp]§Errors
Returns Error::Protocol if:
- Required fields (ID, READ, WRITTEN) are missing
- Numeric values cannot be parsed
Trait Implementations§
Source§impl Clone for CircuitBandwidthEvent
impl Clone for CircuitBandwidthEvent
Source§fn clone(&self) -> CircuitBandwidthEvent
fn clone(&self) -> CircuitBandwidthEvent
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 CircuitBandwidthEvent
impl Debug for CircuitBandwidthEvent
Source§impl Event for CircuitBandwidthEvent
impl Event for CircuitBandwidthEvent
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 CircuitBandwidthEvent
impl RefUnwindSafe for CircuitBandwidthEvent
impl Send for CircuitBandwidthEvent
impl Sync for CircuitBandwidthEvent
impl Unpin for CircuitBandwidthEvent
impl UnwindSafe for CircuitBandwidthEvent
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