pub struct BlockCount(pub u32);
Expand description
Represents the a number of blocks (or sectors). Add this to a BlockIdx
to get an actual address on disk.
Tuple Fields§
§0: u32
Implementations§
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) -> BlockCount
pub fn offset_bytes(self, offset: u32) -> BlockCount
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§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§impl PartialEq for BlockCount
impl PartialEq for BlockCount
Source§impl PartialOrd for BlockCount
impl PartialOrd for BlockCount
Source§fn partial_cmp(&self, other: &BlockCount) -> Option<Ordering>
fn partial_cmp(&self, other: &BlockCount) -> Option<Ordering>
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§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<Q, K> Comparable<K> for Qwhere
Q: Ord + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Comparable<K> for Qwhere
Q: Ord + ?Sized,
K: Borrow<Q> + ?Sized,
Source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.