pub enum ByteCount {
Finite(u64),
Infinite,
Unknown,
}
Expand description
Number of bytes of interest.
Variants§
Implementations§
Source§impl ByteCount
impl ByteCount
Sourcepub fn is_infinite(&self) -> bool
pub fn is_infinite(&self) -> bool
Returns true
if this is ByteCount::Infinite
, otherwise false
.
Sourcepub fn to_u64(self) -> Option<u64>
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.
Sourcepub fn add_for_decoding(self, other: Self) -> Self
pub fn add_for_decoding(self, other: Self) -> Self
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)
Sourcepub fn add_for_encoding(self, other: Self) -> Self
pub fn add_for_encoding(self, other: Self) -> Self
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§
Source§impl PartialOrd for ByteCount
impl PartialOrd for ByteCount
impl Copy for ByteCount
impl Eq for ByteCount
impl StructuralPartialEq for ByteCount
Auto Trait Implementations§
impl Freeze for ByteCount
impl RefUnwindSafe for ByteCount
impl Send for ByteCount
impl Sync for ByteCount
impl Unpin for ByteCount
impl UnwindSafe for ByteCount
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