pub struct Version(/* private fields */);Expand description
protocol version number
technically this is limited to 8 bytes. However it is easy to imagine than more than 256 version numbers are a bit overkill.
Versions will be listed here overtime. However when performing the
handshake, this function will use Version::CURRENT and will check
how the remote’s version match the Version::MIN and Version::MAX.
See is_supported.
Implementations§
Source§impl Version
impl Version
Sourcepub const MIN: Self = Self::V1
pub const MIN: Self = Self::V1
get the minimal supported version supported by this implementation
Sourcepub const MAX: Self = Self::CURRENT
pub const MAX: Self = Self::CURRENT
get the maximal supported version supported by this implementation
Sourcepub fn is_supported(self) -> bool
pub fn is_supported(self) -> bool
returns if the version is currently supported or not
This is similar as to testing the given version against the increasing order:
assert!(
Version::CURRENT.is_supported() ==
(Version::CURRENT >= Version::MIN && Version::CURRENT <= Version::MAX)
);Trait Implementations§
impl Copy for Version
impl Eq for Version
Source§impl Ord for Version
impl Ord for Version
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Version
impl PartialOrd for Version
impl StructuralPartialEq for Version
Auto Trait Implementations§
impl Freeze for Version
impl RefUnwindSafe for Version
impl Send for Version
impl Sync for Version
impl Unpin for Version
impl UnsafeUnpin for Version
impl UnwindSafe for Version
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