#[repr(transparent)]pub struct BlockSize(pub u8);
Expand description
A block size.
Block sizes are powers of 2, with the smallest being 1024 bytes. They are encoded as the power of 2, minus 10, so 1 is 1024 bytes, 2 is 2048 bytes, etc.
Since only powers of 2 are valid, the log2 of the size in bytes / 1024 is given in the constructor. So a block size of 0 is 1024 bytes, 1 is 2048 bytes, etc.
The actual size in bytes can be computed with BlockSize::bytes.
Tuple Fields§
§0: u8
Implementations§
Trait Implementations§
source§impl Ord for BlockSize
impl Ord for BlockSize
source§impl PartialEq for BlockSize
impl PartialEq for BlockSize
source§impl PartialOrd for BlockSize
impl PartialOrd for BlockSize
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 BlockSize
impl Eq for BlockSize
impl StructuralPartialEq for BlockSize
Auto Trait Implementations§
impl RefUnwindSafe for BlockSize
impl Send for BlockSize
impl Sync for BlockSize
impl Unpin for BlockSize
impl UnwindSafe for BlockSize
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