Struct kdevice::cache::CacheGuard[][src]

pub struct CacheGuard<'a, T: Cache>(_);
Expand description

Guard representing the unique ownership of a cache entry.

Implementations

impl<'a, T: Cache> CacheGuard<'a, T>[src]

pub fn is_dirty(&self) -> bool[src]

Check if the buffer is dirty.

pub fn key(&self) -> T::Key[src]

Return the key of this cache entry.

pub fn nlocks(&self) -> usize[src]

Return the key of this cache entry.

pub async fn unlock(self, flush: bool) -> Result<()>[src]

Release the cache entry.

If flush is true, the data will be flushed to disk if modified. Otherwise, it won’t be flushed until dropped from in-memory cache. If error, just release the lock and donot flush any data to disk.

If flush is false, this operation will always succeed.

Trait Implementations

impl<T: Cache> Debug for CacheGuard<'_, T>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<T: Cache> Deref for CacheGuard<'_, T>[src]

type Target = T::Value

The resulting type after dereferencing.

fn deref(&self) -> &Self::Target[src]

Dereferences the value.

impl<T: Cache> DerefMut for CacheGuard<'_, T>[src]

fn deref_mut(&mut self) -> &mut Self::Target[src]

Mutably dereferences the value.

impl<T: Cache> Drop for CacheGuard<'_, T>[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl<'a, T> !RefUnwindSafe for CacheGuard<'a, T>

impl<'a, T> Send for CacheGuard<'a, T> where
    T: Sync,
    <T as Cache>::Key: Sync,
    <T as Cache>::Value: Sync

impl<'a, T> Sync for CacheGuard<'a, T> where
    T: Sync,
    <T as Cache>::Key: Sync,
    <T as Cache>::Value: Sync

impl<'a, T> Unpin for CacheGuard<'a, T>

impl<'a, T> !UnwindSafe for CacheGuard<'a, T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.