pub struct SupportedVersions { /* private fields */ }Expand description
The set of protocol versions a server built against this crate accepts.
ADR-137’s compatibility policy requires a server to support the current version and at least the immediately prior version. This crate is currently at version 1, so there is no prior version yet; the lower bound saturates at 1 rather than underflowing to 0 (there is no version 0).
Implementations§
Source§impl SupportedVersions
impl SupportedVersions
Sourcepub const fn current() -> Self
pub const fn current() -> Self
The default policy: the current version and the immediately prior one.
Sourcepub const fn new(
min: ProtocolVersion,
max: ProtocolVersion,
) -> Result<Self, SupportedVersionsError>
pub const fn new( min: ProtocolVersion, max: ProtocolVersion, ) -> Result<Self, SupportedVersionsError>
Construct an explicit [min, max] inclusive supported range within
the protocol grammar implemented by this crate.
Fails with SupportedVersionsError rather than panicking on an
unusable range:
SupportedVersionsError::MinVersionZeroifminis version 0 — version 0 does not exist in this protocol, and a range admitting it would accept handshakes no conforming client would send.SupportedVersionsError::InvertedRangeifmin > max— an inverted range would silently reject every handshake (no version satisfies it), which is always a configuration bug.SupportedVersionsError::MaxAboveCurrentifmaxexceedsCURRENT_VERSION— this crate cannot admit a version whose wire grammar it does not implement.
pub const fn min(self) -> ProtocolVersion
pub const fn max(self) -> ProtocolVersion
pub const fn contains(self, version: ProtocolVersion) -> bool
Trait Implementations§
Source§impl Clone for SupportedVersions
impl Clone for SupportedVersions
impl Copy for SupportedVersions
Source§impl Debug for SupportedVersions
impl Debug for SupportedVersions
Source§impl Default for SupportedVersions
impl Default for SupportedVersions
impl Eq for SupportedVersions
Source§impl PartialEq for SupportedVersions
impl PartialEq for SupportedVersions
impl StructuralPartialEq for SupportedVersions
Auto Trait Implementations§
impl Freeze for SupportedVersions
impl RefUnwindSafe for SupportedVersions
impl Send for SupportedVersions
impl Sync for SupportedVersions
impl Unpin for SupportedVersions
impl UnsafeUnpin for SupportedVersions
impl UnwindSafe for SupportedVersions
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