pub struct Size { /* private fields */ }Expand description
Size represents a non-negative number of bytes or bits.
It is basically a copy of the Size type in the Rust compiler.
See Size.
Note that the Size type has no upper-bound.
Users needs check whether a given Size is too large for their Machine themselves.
Implementations§
source§impl Size
impl Size
sourcepub fn from_bits(bits: impl Into<Int>) -> Option<Size>
pub fn from_bits(bits: impl Into<Int>) -> Option<Size>
Returns None if bits is negative or not divisible by 8.
sourcepub const fn from_bits_const(bits: u64) -> Option<Size>
pub const fn from_bits_const(bits: u64) -> Option<Size>
Variation of from_bits for const contexts.
Returns None if bits is not divisible by 8.
sourcepub const fn from_bytes_const(bytes: u64) -> Size
pub const fn from_bytes_const(bytes: u64) -> Size
Variation of from_bytes for const contexts.
Cannot fail since the input is unsigned and already in bytes.
Trait Implementations§
source§impl Ord for Size
impl Ord for Size
source§impl PartialEq for Size
impl PartialEq for Size
source§impl PartialOrd for Size
impl PartialOrd for Size
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Copy for Size
impl Eq for Size
impl StructuralPartialEq for Size
Auto Trait Implementations§
impl Freeze for Size
impl RefUnwindSafe for Size
impl !Send for Size
impl !Sync for Size
impl Unpin for Size
impl UnwindSafe for Size
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