Enum bytecodec::ByteCount [−][src]
pub enum ByteCount {
Finite(u64),
Infinite,
Unknown,
}Number of bytes of interest.
Variants
Finite(u64)InfiniteUnknown
Methods
impl ByteCount[src]
impl ByteCountpub fn is_finite(&self) -> bool[src]
pub fn is_finite(&self) -> boolReturns true if this is ByteCount::Finite(_), otherwise false.
pub fn is_infinite(&self) -> bool[src]
pub fn is_infinite(&self) -> boolReturns true if this is ByteCount::Infinite, otherwise false.
pub fn is_unknow(&self) -> bool[src]
pub fn is_unknow(&self) -> boolReturns true if this is ByteCount::Unknown, otherwise false.
pub fn to_u64(&self) -> Option<u64>[src]
pub fn to_u64(&self) -> Option<u64>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]
pub fn add_for_decoding(self, other: Self) -> SelfAdds 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]
pub fn add_for_encoding(self, other: Self) -> SelfAdds 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]
impl Debug for ByteCountfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Clone for ByteCount[src]
impl Clone for ByteCountfn clone(&self) -> ByteCount[src]
fn clone(&self) -> ByteCountReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Copy for ByteCount[src]
impl Copy for ByteCountimpl PartialEq for ByteCount[src]
impl PartialEq for ByteCountfn eq(&self, other: &ByteCount) -> bool[src]
fn eq(&self, other: &ByteCount) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &ByteCount) -> bool[src]
fn ne(&self, other: &ByteCount) -> boolThis method tests for !=.
impl Eq for ByteCount[src]
impl Eq for ByteCountimpl Hash for ByteCount[src]
impl Hash for ByteCountfn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash<__H: Hasher>(&self, state: &mut __H)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]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, Feeds a slice of this type into the given [Hasher]. Read more
impl PartialOrd for ByteCount[src]
impl PartialOrd for ByteCountfn partial_cmp(&self, other: &Self) -> Option<Ordering>[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool1.0.0[src]
fn lt(&self, other: &Rhs) -> boolThis 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]
fn le(&self, other: &Rhs) -> boolThis 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]
fn gt(&self, other: &Rhs) -> boolThis 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]
fn ge(&self, other: &Rhs) -> boolThis method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl Default for ByteCount[src]
impl Default for ByteCount