pub struct Size(pub u64);
Expand description
Represents a size in bytes.
This type wraps a u64
to provide type safety and prevent accidental mixing
of sizes with other numeric values. It supports basic arithmetic operations
and comparison.
§Examples
use codeq::Size;
let size = Size(1024);
let doubled = size + size;
assert_eq!(doubled, Size(2048));
// Sizes can be compared
assert!(Size(100) > Size(50));
// Can be created from u64
let size = Size::from(2048u64);
Tuple Fields§
§0: u64
Trait Implementations§
Source§impl AddAssign<Size> for Offset
impl AddAssign<Size> for Offset
Source§fn add_assign(&mut self, rhs: Size)
fn add_assign(&mut self, rhs: Size)
Performs the
+=
operation. Read moreSource§impl AddAssign for Size
impl AddAssign for Size
Source§fn add_assign(&mut self, rhs: Size)
fn add_assign(&mut self, rhs: Size)
Performs the
+=
operation. Read moreSource§impl Ord for Size
impl Ord for Size
Source§impl PartialOrd for Size
impl PartialOrd for Size
Source§impl SubAssign<Size> for Offset
impl SubAssign<Size> for Offset
Source§fn sub_assign(&mut self, rhs: Size)
fn sub_assign(&mut self, rhs: Size)
Performs the
-=
operation. Read moreSource§impl SubAssign for Size
impl SubAssign for Size
Source§fn sub_assign(&mut self, rhs: Size)
fn sub_assign(&mut self, rhs: Size)
Performs the
-=
operation. 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