pub struct BlockSize(/* private fields */);Expand description
Size of a block in bytes.
This type enforces some restrictions on the block size: it must be
at least 512 bytes and fit within a u32.
§Minimum size
The MasterBootRecord size is 512 bytes and must fit within a
block, so the block size must be at least that large.
Implementations§
Source§impl BlockSize
impl BlockSize
Sourcepub fn from_usize(num_bytes: usize) -> Option<Self>
pub fn from_usize(num_bytes: usize) -> Option<Self>
Create a BlockSize.
Sourcepub fn is_multiple_of_block_size<T>(&self, value: T) -> bool
pub fn is_multiple_of_block_size<T>(&self, value: T) -> bool
Sourcepub fn assert_valid_block_buffer(&self, buffer: &[u8])
pub fn assert_valid_block_buffer(&self, buffer: &[u8])
Assert that the buffer size is an even multiple of the block size.
§Panics
Panics if buffer.len() is not an even multiple of the block size.
Trait Implementations§
Source§impl Ord for BlockSize
impl Ord for BlockSize
Source§impl PartialOrd for BlockSize
impl PartialOrd for BlockSize
impl Copy for BlockSize
impl Eq for BlockSize
impl StructuralPartialEq for BlockSize
Auto Trait Implementations§
impl Freeze for BlockSize
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