Enum bytecodec::ByteCount
[−]
[src]
pub enum ByteCount {
Finite(u64),
Infinite,
Unknown,
}Number of bytes of interest.
Variants
Finite(u64)InfiniteUnknown
Methods
impl ByteCount[src]
pub fn is_finite(&self) -> bool[src]
Returns true if this is ByteCount::Finite(_), otherwise false.
pub fn is_infinite(&self) -> bool[src]
Returns true if this is ByteCount::Infinite, otherwise false.
pub fn is_unknow(&self) -> bool[src]
Returns true if this is ByteCount::Unknown, otherwise false.
pub fn to_u64(&self) -> Option<u64>[src]
Tries to convert this ByteCount to an u64 value.
If it is not a ByteCount::Finite(_),None will be returned.
pub fn add_for_decoding(self, other: Self) -> Self[src]
Adds two ByteCount instances for decoding (i.e., Decode::requiring_bytes method).
Rule
Finite(a) + Finite(b) = Finite(a + b)
Infinite + _ = Infinite
_ + Infinite = Infinite
Unknown + Unknown = Unknown
Finite(0) + Unknown = Unknown
Unknown + Finite(0) = Unknown
Finite(a) + Unknown = Finite(a)
Unknown + Finite(b) = Finite(b)
pub fn add_for_encoding(self, other: Self) -> Self[src]
Adds two ByteCount instances for encoding (i.e., Encode::requiring_bytes method).
Rule
Finite(a) + Finite(b) = Finite(a + b)
Infinite + _ = Infinite
_ + Infinite = Infinite
Unknown + _ = Unknown
_ + Unknown = Unknown
Trait Implementations
impl Debug for ByteCount[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more
impl Clone for ByteCount[src]
fn clone(&self) -> ByteCount[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Copy for ByteCount[src]
impl PartialEq for ByteCount[src]
fn eq(&self, __arg_0: &ByteCount) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &ByteCount) -> bool[src]
This method tests for !=.
impl Eq for ByteCount[src]
impl Hash for ByteCount[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)[src]
Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher]. Read more
impl PartialOrd for ByteCount[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool1.0.0[src]
This method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, other: &Rhs) -> bool1.0.0[src]
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, other: &Rhs) -> bool1.0.0[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, other: &Rhs) -> bool1.0.0[src]
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more