pub struct DegradePolicy { /* private fields */ }Expand description
The downgrades a caller will accept when a feature is unavailable.
Separate from FeatureProfile on purpose: a profile is a fact, and a
policy is a decision. Keeping them apart means “what can this session do”
and “what will this caller settle for” are separately testable, and a
session cannot quietly relax its own requirements.
Implementations§
Source§impl DegradePolicy
impl DegradePolicy
Sourcepub fn permissive() -> Self
pub fn permissive() -> Self
Every feature may be downgraded. For a prober that wants to know what a peer will tolerate, never for a server serving a client.
Sourcepub fn accepts(self, profile: FeatureProfile) -> bool
pub fn accepts(self, profile: FeatureProfile) -> bool
Whether the session’s profile is acceptable under this policy.
True when every feature the session lacks is one the policy allows
to be missing. A strict policy therefore accepts only a profile with
everything, which is the point: the caller has to opt in to each
individual loss.
Trait Implementations§
Source§impl Clone for DegradePolicy
impl Clone for DegradePolicy
impl Copy for DegradePolicy
Source§impl Debug for DegradePolicy
impl Debug for DegradePolicy
Source§impl Default for DegradePolicy
impl Default for DegradePolicy
impl Eq for DegradePolicy
Source§impl Hash for DegradePolicy
impl Hash for DegradePolicy
Source§impl PartialEq for DegradePolicy
impl PartialEq for DegradePolicy
impl StructuralPartialEq for DegradePolicy
Auto Trait Implementations§
impl Freeze for DegradePolicy
impl RefUnwindSafe for DegradePolicy
impl Send for DegradePolicy
impl Sync for DegradePolicy
impl Unpin for DegradePolicy
impl UnsafeUnpin for DegradePolicy
impl UnwindSafe for DegradePolicy
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