pub struct BandwidthEstimator { /* private fields */ }Expand description
Bandwidth estimator
Implementations§
Source§impl BandwidthEstimator
impl BandwidthEstimator
Sourcepub fn record_transfer(&mut self, bytes: usize, time_ms: f64)
pub fn record_transfer(&mut self, bytes: usize, time_ms: f64)
Records a transfer
Sourcepub fn record_download(&mut self, bytes: usize, time_ms: f64)
pub fn record_download(&mut self, bytes: usize, time_ms: f64)
Records a download (alias for record_transfer for test compatibility)
Sourcepub const fn estimate(&self) -> f64
pub const fn estimate(&self) -> f64
Estimates current bandwidth (returns bandwidth in bytes per second)
Sourcepub const fn bandwidth_bps(&self) -> f64
pub const fn bandwidth_bps(&self) -> f64
Returns the current bandwidth estimate in bytes per second
Sourcepub fn bandwidth_mbps(&self) -> f64
pub fn bandwidth_mbps(&self) -> f64
Returns the current bandwidth estimate in megabits per second
Sourcepub fn estimate_download_time(&self, bytes: usize) -> f64
pub fn estimate_download_time(&self, bytes: usize) -> f64
Estimates time to download a given size (in milliseconds)
Sourcepub fn is_sufficient_for_quality(&self, quality: StreamingQuality) -> bool
pub fn is_sufficient_for_quality(&self, quality: StreamingQuality) -> bool
Checks if bandwidth is sufficient for quality
Sourcepub fn suggest_quality(&self) -> StreamingQuality
pub fn suggest_quality(&self) -> StreamingQuality
Suggests optimal quality based on bandwidth
Trait Implementations§
Source§impl Clone for BandwidthEstimator
impl Clone for BandwidthEstimator
Source§fn clone(&self) -> BandwidthEstimator
fn clone(&self) -> BandwidthEstimator
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 BandwidthEstimator
impl Debug for BandwidthEstimator
Auto Trait Implementations§
impl Freeze for BandwidthEstimator
impl RefUnwindSafe for BandwidthEstimator
impl Send for BandwidthEstimator
impl Sync for BandwidthEstimator
impl Unpin for BandwidthEstimator
impl UnsafeUnpin for BandwidthEstimator
impl UnwindSafe for BandwidthEstimator
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