pub struct ProxyQualitySelector { /* private fields */ }Expand description
Selects the best ProxyQualityTier for a given available bandwidth.
Implementations§
Source§impl ProxyQualitySelector
impl ProxyQualitySelector
Sourcepub fn with_configs(configs: Vec<ProxyQualityConfig>) -> Self
pub fn with_configs(configs: Vec<ProxyQualityConfig>) -> Self
Create a selector with custom configs.
Sourcepub fn select_for_bandwidth(
&self,
available_bandwidth_kbps: u32,
) -> Option<&ProxyQualityConfig>
pub fn select_for_bandwidth( &self, available_bandwidth_kbps: u32, ) -> Option<&ProxyQualityConfig>
Select the highest-quality tier that fits available_bandwidth_kbps.
Returns None if even the lowest tier exceeds the budget.
Sourcepub fn all_tiers(&self) -> Vec<&ProxyQualityConfig>
pub fn all_tiers(&self) -> Vec<&ProxyQualityConfig>
Return all configs sorted from lowest to highest quality.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ProxyQualitySelector
impl RefUnwindSafe for ProxyQualitySelector
impl Send for ProxyQualitySelector
impl Sync for ProxyQualitySelector
impl Unpin for ProxyQualitySelector
impl UnsafeUnpin for ProxyQualitySelector
impl UnwindSafe for ProxyQualitySelector
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
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