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: u64Trait Implementations§
Source§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 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 moreimpl Copy for Size
impl Eq for Size
Source§impl Ord for Size
impl Ord for Size
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Size
impl PartialOrd 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 UnsafeUnpin 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