pub struct BlockCount(pub u32);Expand description
The a number of blocks (or sectors).
Add this to a BlockIdx to get an actual address on disk.
Tuple Fields§
§0: u32Implementations§
Source§impl BlockCount
 
impl BlockCount
Sourcepub const fn from_bytes(byte_count: u32) -> BlockCount
 
pub const fn from_bytes(byte_count: u32) -> BlockCount
How many blocks are required to hold this many bytes.
assert_eq!(BlockCount::from_bytes(511), BlockCount(1));
assert_eq!(BlockCount::from_bytes(512), BlockCount(1));
assert_eq!(BlockCount::from_bytes(513), BlockCount(2));
assert_eq!(BlockCount::from_bytes(1024), BlockCount(2));
assert_eq!(BlockCount::from_bytes(1025), BlockCount(3));Sourcepub fn offset_bytes(self, offset: u32) -> Self
 
pub fn offset_bytes(self, offset: u32) -> Self
Take a number of blocks and increment by the integer number of blocks required to get to the block that holds the byte at the given offset.
Trait Implementations§
Source§impl Add<BlockCount> for BlockIdx
 
impl Add<BlockCount> for BlockIdx
Source§impl Add for BlockCount
 
impl Add for BlockCount
Source§type Output = BlockCount
 
type Output = BlockCount
The resulting type after applying the 
+ operator.Source§fn add(self, rhs: BlockCount) -> BlockCount
 
fn add(self, rhs: BlockCount) -> BlockCount
Performs the 
+ operation. Read moreSource§impl AddAssign<BlockCount> for BlockIdx
 
impl AddAssign<BlockCount> for BlockIdx
Source§fn add_assign(&mut self, rhs: BlockCount)
 
fn add_assign(&mut self, rhs: BlockCount)
Performs the 
+= operation. Read moreSource§impl AddAssign for BlockCount
 
impl AddAssign for BlockCount
Source§fn add_assign(&mut self, rhs: BlockCount)
 
fn add_assign(&mut self, rhs: BlockCount)
Performs the 
+= operation. Read moreSource§impl Clone for BlockCount
 
impl Clone for BlockCount
Source§fn clone(&self) -> BlockCount
 
fn clone(&self) -> BlockCount
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 
source. Read moreSource§impl Debug for BlockCount
 
impl Debug for BlockCount
Source§impl Ord for BlockCount
 
impl Ord for BlockCount
Source§fn cmp(&self, other: &BlockCount) -> Ordering
 
fn cmp(&self, other: &BlockCount) -> Ordering
1.21.0 · 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 PartialEq for BlockCount
 
impl PartialEq for BlockCount
Source§impl PartialOrd for BlockCount
 
impl PartialOrd for BlockCount
Source§impl Sub<BlockCount> for BlockIdx
 
impl Sub<BlockCount> for BlockIdx
Source§impl Sub for BlockCount
 
impl Sub for BlockCount
Source§type Output = BlockCount
 
type Output = BlockCount
The resulting type after applying the 
- operator.Source§fn sub(self, rhs: BlockCount) -> BlockCount
 
fn sub(self, rhs: BlockCount) -> BlockCount
Performs the 
- operation. Read moreSource§impl SubAssign<BlockCount> for BlockIdx
 
impl SubAssign<BlockCount> for BlockIdx
Source§fn sub_assign(&mut self, rhs: BlockCount)
 
fn sub_assign(&mut self, rhs: BlockCount)
Performs the 
-= operation. Read moreSource§impl SubAssign for BlockCount
 
impl SubAssign for BlockCount
Source§fn sub_assign(&mut self, rhs: BlockCount)
 
fn sub_assign(&mut self, rhs: BlockCount)
Performs the 
-= operation. Read moreimpl Copy for BlockCount
impl Eq for BlockCount
impl StructuralPartialEq for BlockCount
Auto Trait Implementations§
impl Freeze for BlockCount
impl RefUnwindSafe for BlockCount
impl Send for BlockCount
impl Sync for BlockCount
impl Unpin for BlockCount
impl UnwindSafe for BlockCount
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