Enum bytecodec::ByteCount [−][src]
Number of bytes of interest.
Variants
Finite(u64)Implementations
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 Clone for ByteCount[src]
impl Copy for ByteCount[src]
impl Debug for ByteCount[src]
impl Default for ByteCount[src]
impl Eq for ByteCount[src]
impl Hash for ByteCount[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl PartialEq<ByteCount> for ByteCount[src]
impl PartialOrd<ByteCount> for ByteCount[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl StructuralEq for ByteCount[src]
impl StructuralPartialEq for ByteCount[src]
Auto Trait Implementations
impl RefUnwindSafe for ByteCount
impl Send for ByteCount
impl Sync for ByteCount
impl Unpin for ByteCount
impl UnwindSafe for ByteCount
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,