pub struct ProtocolVersion {
pub major: u16,
pub minor: u16,
}Expand description
Protocol version for client-daemon communication.
Uses semantic versioning: major.minor
- Major version bump: breaking changes, incompatible
- Minor version bump: additive changes, backward compatible
Fields§
§major: u16§minor: u16Implementations§
Source§impl ProtocolVersion
impl ProtocolVersion
Sourcepub const CURRENT: ProtocolVersion
pub const CURRENT: ProtocolVersion
Current protocol version.
Sourcepub fn parse(s: &str) -> Result<Self, VersionError>
pub fn parse(s: &str) -> Result<Self, VersionError>
Parses a version string like “1.0”.
Sourcepub fn is_compatible_with(&self, other: &ProtocolVersion) -> bool
pub fn is_compatible_with(&self, other: &ProtocolVersion) -> bool
Returns true if this version is compatible with another.
Compatibility rules:
- Major versions must match
- Any minor version is compatible within the same major version
Sourcepub fn is_newer_than(&self, other: &ProtocolVersion) -> bool
pub fn is_newer_than(&self, other: &ProtocolVersion) -> bool
Returns true if this version is newer than another.
Sourcepub fn is_current(&self) -> bool
pub fn is_current(&self) -> bool
Returns true if this version is the current version.
Trait Implementations§
Source§impl Clone for ProtocolVersion
impl Clone for ProtocolVersion
Source§fn clone(&self) -> ProtocolVersion
fn clone(&self) -> ProtocolVersion
Returns a duplicate of the value. Read more
1.0.0 · 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 ProtocolVersion
impl Debug for ProtocolVersion
Source§impl Default for ProtocolVersion
impl Default for ProtocolVersion
Source§impl<'de> Deserialize<'de> for ProtocolVersion
impl<'de> Deserialize<'de> for ProtocolVersion
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ProtocolVersion
impl Display for ProtocolVersion
Source§impl PartialEq for ProtocolVersion
impl PartialEq for ProtocolVersion
Source§impl Serialize for ProtocolVersion
impl Serialize for ProtocolVersion
impl Eq for ProtocolVersion
impl StructuralPartialEq for ProtocolVersion
Auto Trait Implementations§
impl Freeze for ProtocolVersion
impl RefUnwindSafe for ProtocolVersion
impl Send for ProtocolVersion
impl Sync for ProtocolVersion
impl Unpin for ProtocolVersion
impl UnsafeUnpin for ProtocolVersion
impl UnwindSafe for ProtocolVersion
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