BlockPointsToReadGuard

Struct BlockPointsToReadGuard 

Source
pub struct BlockPointsToReadGuard<'a, M: MetaData> {
    b: Option<SpinLockGuard<'a, [u8; 4096]>>,
    _m: PhantomData<M>,
}
Expand description

A read-only guard that provides typed access to a metadata block.

BlockPointsToReadGuard is returned by BlockPointsTo::read and allows immutable access to the contents of a 4096-byte disk block as a value of type M, which implements the MetaData trait.

Internally, it wraps a locked reference to the block’s byte array using a SpinLockGuard and casts it to the metadata type using unsafe pointer casting. The guard ensures that the block cannot be modified while borrowed immutably.

§Use Case

Use this when you want to inspect metadata structures (like an inode table, superblock, or bitmap) without modifying them.

Fields§

§b: Option<SpinLockGuard<'a, [u8; 4096]>>

Spinlock guard for the raw block data.

§_m: PhantomData<M>

Marker to associate the block with its metadata type.

Trait Implementations§

Source§

impl<M: MetaData> Deref for BlockPointsToReadGuard<'_, M>

Source§

type Target = M

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<M: MetaData> Drop for BlockPointsToReadGuard<'_, M>

Source§

fn drop(&mut self)

Ensures the spinlock is released when the guard goes out of scope.

Auto Trait Implementations§

§

impl<'a, M> Freeze for BlockPointsToReadGuard<'a, M>

§

impl<'a, M> !RefUnwindSafe for BlockPointsToReadGuard<'a, M>

§

impl<'a, M> !Send for BlockPointsToReadGuard<'a, M>

§

impl<'a, M> Sync for BlockPointsToReadGuard<'a, M>
where M: Sync,

§

impl<'a, M> Unpin for BlockPointsToReadGuard<'a, M>
where M: Unpin,

§

impl<'a, M> !UnwindSafe for BlockPointsToReadGuard<'a, M>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.