pub struct Size { /* private fields */ }
Expand description
Size of a type in bytes.
Implementations§
Source§impl Size
impl Size
pub const ZERO: Size = _
Sourcepub fn from_bits(bits: impl TryInto<u64>) -> Size
pub fn from_bits(bits: impl TryInto<u64>) -> Size
Rounds bits
up to the next-higher byte boundary, if bits
is
not a multiple of 8.
pub fn from_bytes(bytes: impl TryInto<u64>) -> Size
pub fn bytes(self) -> u64
pub fn bytes_usize(self) -> usize
pub fn bits(self) -> u64
pub fn bits_usize(self) -> usize
pub fn align_to(self, align: Align) -> Size
pub fn is_aligned(self, align: Align) -> bool
pub fn checked_add<C: HasDataLayout>(self, offset: Size, cx: &C) -> Option<Size>
pub fn checked_mul<C: HasDataLayout>(self, count: u64, cx: &C) -> Option<Size>
Sourcepub fn sign_extend(self, value: u128) -> i128
pub fn sign_extend(self, value: u128) -> i128
Truncates value
to self
bits and then sign-extends it to 128 bits
(i.e., if it is negative, fill with 1’s on the left).
pub fn signed_int_min(&self) -> i128
pub fn signed_int_max(&self) -> i128
pub fn unsigned_int_max(&self) -> u128
Trait Implementations§
Source§impl AddAssign for Size
impl AddAssign for Size
Source§fn add_assign(&mut self, other: Size)
fn add_assign(&mut self, other: Size)
Performs the
+=
operation. Read moreSource§impl Ord for Size
impl Ord for Size
Source§impl PartialOrd for Size
impl PartialOrd for Size
impl 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