pub struct LazyMutex<T> { /* private fields */ }
Expand description
A lazy-initialized mutex.
This is used to lazily initialize a nucleo matcher (which pre-allocates quite a bit of memory upfront which can be expensive during initialization).
§Example
use television_fuzzy::matcher::lazy::LazyMutex;
struct Thing {
// ...
}
impl Thing {
fn new() -> Self {
// something expensive
Thing { }
}
}
static THING_TO_LAZY_INIT: LazyMutex<Thing> = LazyMutex::new(|| {
Thing::new()
});
let _thing = THING_TO_LAZY_INIT.lock();
Implementations§
Auto Trait Implementations§
impl<T> !Freeze for LazyMutex<T>
impl<T> !RefUnwindSafe for LazyMutex<T>
impl<T> Send for LazyMutex<T>where
T: Send,
impl<T> Sync for LazyMutex<T>where
T: Send,
impl<T> Unpin for LazyMutex<T>where
T: Unpin,
impl<T> UnwindSafe for LazyMutex<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more