pub struct Bytes(/* private fields */);Expand description
Canonical base type: raw bytes.
Implementations§
Trait Implementations§
Source§impl MemorySize for Bytes
impl MemorySize for Bytes
Source§const BYTES_PER_UNIT: u64 = 1
const BYTES_PER_UNIT: u64 = 1
Exact bytes per 1 unit of this type (e.g., MiB = 1_048_576).
Source§fn to_bytes(self) -> Result<Bytes, MemConvError>
fn to_bytes(self) -> Result<Bytes, MemConvError>
Convert to raw bytes as a
Bytes newtype (checked multiply).Source§fn to_rounded<T: MemorySize>(self, mode: Rounding) -> Result<T, MemConvError>
fn to_rounded<T: MemorySize>(self, mode: Rounding) -> Result<T, MemConvError>
Convert to another memory unit with rounding. Read more
Source§fn to_exact<T: MemorySize>(self) -> Result<T, MemConvError>
fn to_exact<T: MemorySize>(self) -> Result<T, MemConvError>
Convert to another unit only if exact (no remainder).
Source§fn checked_add(self, rhs: Self) -> Option<Self>
fn checked_add(self, rhs: Self) -> Option<Self>
Checked addition. Returns
None on overflow.Source§fn checked_sub(self, rhs: Self) -> Option<Self>
fn checked_sub(self, rhs: Self) -> Option<Self>
Checked subtraction. Returns
None on underflow.Source§fn saturating_add(self, rhs: Self) -> Self
fn saturating_add(self, rhs: Self) -> Self
Saturating addition. Clamps at
u64::MAX on overflow.Source§fn saturating_sub(self, rhs: Self) -> Self
fn saturating_sub(self, rhs: Self) -> Self
Saturating subtraction. Clamps at zero on underflow.
Source§impl Ord for Bytes
impl Ord for Bytes
Source§impl PartialOrd for Bytes
impl PartialOrd for Bytes
impl Copy for Bytes
impl Eq for Bytes
impl StructuralPartialEq for Bytes
Auto Trait Implementations§
impl Freeze for Bytes
impl RefUnwindSafe for Bytes
impl Send for Bytes
impl Sync for Bytes
impl Unpin for Bytes
impl UnsafeUnpin for Bytes
impl UnwindSafe for Bytes
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