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<Size> for Size
impl PartialEq<Size> for Size
source§impl PartialOrd<Size> for Size
impl PartialOrd<Size> 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 more