OwnedIconCache

Struct OwnedIconCache 

Source
pub struct OwnedIconCache {
    pub lock: FileLock,
    pub memmap: Mmap,
}
Expand description

Provides access to an IconCache constructed from a file that is guaranteed not to be modified.

OwnedIconCache holds a lock on the cache file and creates a memory-mapped region with the file’s contents inside. It does not copy the file contents.

To access the icon cache, use OwnedIconCache::icon_cache

Fields§

§lock: FileLock§memmap: Mmap

Implementations§

Source§

impl OwnedIconCache

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self>

Open and lock a file. This call may block waiting to acquire a lock if an exclusive lock is already held.

If this behaviour is undesirable, use open_non_blocking instead.

Source

pub fn open_non_blocking(path: impl AsRef<Path>) -> Result<Self>

Open and lock a file, returning an error if an exclusive lock on the file was already held by another process.

Source

pub fn icon_cache<'a>(&'a self) -> Result<IconCache<'a>, Box<dyn Error + 'a>>

Access the icon cache held by this OwnedIconCache.

Returns an error if the cache could not be parsed.

Source

pub fn from_lock(lock: FileLock) -> Result<Self>

Create a OwnedIconCache from a locked file

Trait Implementations§

Source§

impl Debug for OwnedIconCache

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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>,

Source§

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

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

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

Performs the conversion.