pub struct WebRTCState {
pub peers: RwLock<HashMap<String, PeerEntry>>,
pub connected_count: AtomicUsize,
pub bytes_sent: AtomicU64,
pub bytes_received: AtomicU64,
}Expand description
Shared state for WebRTC manager
Fields§
§peers: RwLock<HashMap<String, PeerEntry>>§connected_count: AtomicUsize§bytes_sent: AtomicU64Total bytes sent across all peers (cumulative)
bytes_received: AtomicU64Total bytes received across all peers (cumulative)
Implementations§
Source§impl WebRTCState
impl WebRTCState
pub fn new() -> Self
Sourcepub fn get_bandwidth(&self) -> (u64, u64)
pub fn get_bandwidth(&self) -> (u64, u64)
Get current bandwidth stats (bytes sent/received)
Sourcepub async fn record_sent(&self, peer_id: &str, bytes: u64)
pub async fn record_sent(&self, peer_id: &str, bytes: u64)
Record bytes sent (global + per-peer)
Sourcepub async fn record_received(&self, peer_id: &str, bytes: u64)
pub async fn record_received(&self, peer_id: &str, bytes: u64)
Record bytes received (global + per-peer)
Auto Trait Implementations§
impl !Freeze for WebRTCState
impl !RefUnwindSafe for WebRTCState
impl Send for WebRTCState
impl Sync for WebRTCState
impl Unpin for WebRTCState
impl !UnwindSafe for WebRTCState
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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