Struct casper_types::ProtocolVersion
source · pub struct ProtocolVersion(/* private fields */);
Expand description
A newtype wrapping a SemVer
which represents a Casper Platform protocol version.
Implementations§
source§impl ProtocolVersion
impl ProtocolVersion
sourcepub const V1_0_0: ProtocolVersion = _
pub const V1_0_0: ProtocolVersion = _
Version 1.0.0.
sourcepub const fn new(version: SemVer) -> ProtocolVersion
pub const fn new(version: SemVer) -> ProtocolVersion
Constructs a new ProtocolVersion
from version
.
sourcepub const fn from_parts(major: u32, minor: u32, patch: u32) -> ProtocolVersion
pub const fn from_parts(major: u32, minor: u32, patch: u32) -> ProtocolVersion
Constructs a new ProtocolVersion
from the given semver parts.
sourcepub fn check_next_version(&self, next: &ProtocolVersion) -> VersionCheckResult
pub fn check_next_version(&self, next: &ProtocolVersion) -> VersionCheckResult
Checks if next version can be followed.
sourcepub fn is_compatible_with(&self, version: &ProtocolVersion) -> bool
pub fn is_compatible_with(&self, version: &ProtocolVersion) -> bool
Checks if given protocol version is compatible with current one.
Two protocol versions with different major version are considered to be incompatible.
Trait Implementations§
source§impl Clone for ProtocolVersion
impl Clone for ProtocolVersion
source§fn clone(&self) -> ProtocolVersion
fn clone(&self) -> ProtocolVersion
Returns a copy 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§fn default() -> ProtocolVersion
fn default() -> ProtocolVersion
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for ProtocolVersion
impl<'de> Deserialize<'de> for ProtocolVersion
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for ProtocolVersion
impl Display for ProtocolVersion
source§impl FromBytes for ProtocolVersion
impl FromBytes for ProtocolVersion
source§impl FromStr for ProtocolVersion
impl FromStr for ProtocolVersion
source§impl Hash for ProtocolVersion
impl Hash for ProtocolVersion
source§impl Ord for ProtocolVersion
impl Ord for ProtocolVersion
source§fn cmp(&self, other: &ProtocolVersion) -> Ordering
fn cmp(&self, other: &ProtocolVersion) -> Ordering
1.21.0 · 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
source§impl PartialEq for ProtocolVersion
impl PartialEq for ProtocolVersion
source§impl PartialOrd for ProtocolVersion
impl PartialOrd for ProtocolVersion
source§impl Serialize for ProtocolVersion
impl Serialize for ProtocolVersion
source§impl ToBytes for ProtocolVersion
impl ToBytes for ProtocolVersion
source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Returns the length of the
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.impl Copy 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 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)