pub struct WeightConfig {
pub default_weights: TypeWeights,
/* private fields */
}Expand description
Table of per-media-type weight overrides.
Any type not present in the table falls back to default_weights.
Fields§
§default_weights: TypeWeightsDefault weights applied when the entry type has no specific override.
Implementations§
Source§impl WeightConfig
impl WeightConfig
Sourcepub fn set_weights(&mut self, media_type: CacheMediaType, weights: TypeWeights)
pub fn set_weights(&mut self, media_type: CacheMediaType, weights: TypeWeights)
Insert or replace the weight overrides for media_type.
Sourcepub fn weights_for(&self, media_type: CacheMediaType) -> TypeWeights
pub fn weights_for(&self, media_type: CacheMediaType) -> TypeWeights
Look up the weights for media_type, falling back to default_weights.
Sourcepub fn validate(&self) -> Result<(), WeightedCacheError>
pub fn validate(&self) -> Result<(), WeightedCacheError>
Validate that all weights are finite and non-negative.
Trait Implementations§
Source§impl Clone for WeightConfig
impl Clone for WeightConfig
Source§fn clone(&self) -> WeightConfig
fn clone(&self) -> WeightConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 WeightConfig
impl Debug for WeightConfig
Auto Trait Implementations§
impl Freeze for WeightConfig
impl RefUnwindSafe for WeightConfig
impl Send for WeightConfig
impl Sync for WeightConfig
impl Unpin for WeightConfig
impl UnsafeUnpin for WeightConfig
impl UnwindSafe for WeightConfig
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