# Struct os::fs::easy_fs::block_cache::BLOCK_CACHE_MANAGER

source · [−]

    pub struct BLOCK_CACHE_MANAGER {
        __private_field: (),
    }

## Fields

`__private_field: ()`

## Methods from Deref<Target = Mutex<BlockCacheManager>>

#### pub fn is_locked(&self) -> bool

Returns `true` if the lock is currently held.

##### Safety

This function provides no synchronization guarantees and so its result should be considered ‘out of date’ the instant it is called. Do not use it for synchronization purposes. However, it may be useful as a heuristic.

#### pub fn lock(&self) -> MutexGuard<'_, T>

Locks the [`Mutex`] and returns a guard that permits access to the inner data.

The returned value may be dereferenced for data access and the lock will be dropped when the guard falls out of scope.

    let lock = spin::Mutex::new(0);
    {
        let mut data = lock.lock();
        // The lock is now locked and the data can be accessed
        *data += 1;
        // The lock is implicitly dropped at the end of the scope
    }

#### pub unsafe fn force_unlock(&self)

Force unlock this [`Mutex`].

##### Safety

This is extremely unsafe if the lock is not held by the current thread. However, this can be useful in some instances for exposing the lock to FFI that doesn’t know how to deal with RAII.

#### pub fn try_lock(&self) -> Option<MutexGuard<'_, T>>

Try to lock this [`Mutex`], returning a lock guard if successful.

##### Example

    let lock = spin::Mutex::new(42);

    let maybe_guard = lock.try_lock();
    assert!(maybe_guard.is_some());

    // `maybe_guard` is still held, so the second call fails
    let maybe_guard2 = lock.try_lock();
    assert!(maybe_guard2.is_none());

## Trait Implementations

source

### impl Deref for BLOCK_CACHE_MANAGER

#### type Target = Mutex<BlockCacheManager>

The resulting type after dereferencing.

source

#### fn deref(&self) -> &Mutex<BlockCacheManager>

Dereferences the value.

source

### impl LazyStatic for BLOCK_CACHE_MANAGER

## Auto Trait Implementations

### impl RefUnwindSafe for BLOCK_CACHE_MANAGER

### impl Send for BLOCK_CACHE_MANAGER

### impl Sync for BLOCK_CACHE_MANAGER

### impl Unpin for BLOCK_CACHE_MANAGER

### impl UnwindSafe for BLOCK_CACHE_MANAGER

## Blanket Implementations

source

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

source

#### pub fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more

source

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

source

#### pub fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

source

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

source

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

Mutably borrows from an owned value. Read more

source

### impl<T> From<T> for T

source

#### pub fn from(t: T) -> T

Performs the conversion.

source

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

source

#### pub fn into(self) -> U

Performs the conversion.

source

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

#### type Error = Infallible

The type returned in the event of a conversion error.

source

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

Performs the conversion.

source

### 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.

source

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

Performs the conversion.