use std::hash::{Hash, BuildHasher};
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut};
-use owning_ref::{Erased, OwningRef};
+use crate::owning_ref::{Erased, OwningRef};
pub fn serial_join<A, B, RA, RB>(oper_a: A, oper_b: B) -> (RA, RB)
where A: FnOnce() -> RA,
}
#[inline(always)]
- pub fn lock(&self) -> LockGuard<T> {
+ pub fn lock(&self) -> LockGuard<'_, T> {
self.0.lock()
}
#[inline(always)]
- pub fn lock_mut(&self) -> LockGuard<T> {
+ pub fn lock_mut(&self) -> LockGuard<'_, T> {
self.lock()
}
}
#[cfg(parallel_compiler)]
#[inline(always)]
- pub fn try_lock(&self) -> Option<LockGuard<T>> {
+ pub fn try_lock(&self) -> Option<LockGuard<'_, T>> {
self.0.try_lock()
}
#[cfg(not(parallel_compiler))]
#[inline(always)]
- pub fn try_lock(&self) -> Option<LockGuard<T>> {
+ pub fn try_lock(&self) -> Option<LockGuard<'_, T>> {
self.0.try_borrow_mut().ok()
}
#[cfg(parallel_compiler)]
#[inline(always)]
- pub fn lock(&self) -> LockGuard<T> {
+ pub fn lock(&self) -> LockGuard<'_, T> {
if ERROR_CHECKING {
self.0.try_lock().expect("lock was already held")
} else {
#[cfg(not(parallel_compiler))]
#[inline(always)]
- pub fn lock(&self) -> LockGuard<T> {
+ pub fn lock(&self) -> LockGuard<'_, T> {
self.0.borrow_mut()
}
}
#[inline(always)]
- pub fn borrow(&self) -> LockGuard<T> {
+ pub fn borrow(&self) -> LockGuard<'_, T> {
self.lock()
}
#[inline(always)]
- pub fn borrow_mut(&self) -> LockGuard<T> {
+ pub fn borrow_mut(&self) -> LockGuard<'_, T> {
self.lock()
}
}
#[cfg(not(parallel_compiler))]
#[inline(always)]
- pub fn read(&self) -> ReadGuard<T> {
+ pub fn read(&self) -> ReadGuard<'_, T> {
self.0.borrow()
}
#[cfg(parallel_compiler)]
#[inline(always)]
- pub fn read(&self) -> ReadGuard<T> {
+ pub fn read(&self) -> ReadGuard<'_, T> {
if ERROR_CHECKING {
self.0.try_read().expect("lock was already held")
} else {
#[cfg(not(parallel_compiler))]
#[inline(always)]
- pub fn try_write(&self) -> Result<WriteGuard<T>, ()> {
+ pub fn try_write(&self) -> Result<WriteGuard<'_, T>, ()> {
self.0.try_borrow_mut().map_err(|_| ())
}
#[cfg(parallel_compiler)]
#[inline(always)]
- pub fn try_write(&self) -> Result<WriteGuard<T>, ()> {
+ pub fn try_write(&self) -> Result<WriteGuard<'_, T>, ()> {
self.0.try_write().ok_or(())
}
#[cfg(not(parallel_compiler))]
#[inline(always)]
- pub fn write(&self) -> WriteGuard<T> {
+ pub fn write(&self) -> WriteGuard<'_, T> {
self.0.borrow_mut()
}
#[cfg(parallel_compiler)]
#[inline(always)]
- pub fn write(&self) -> WriteGuard<T> {
+ pub fn write(&self) -> WriteGuard<'_, T> {
if ERROR_CHECKING {
self.0.try_write().expect("lock was already held")
} else {
}
#[inline(always)]
- pub fn borrow(&self) -> ReadGuard<T> {
+ pub fn borrow(&self) -> ReadGuard<'_, T> {
self.read()
}
#[inline(always)]
- pub fn borrow_mut(&self) -> WriteGuard<T> {
+ pub fn borrow_mut(&self) -> WriteGuard<'_, T> {
self.write()
}
}