pub struct RwRefAccess<T> { /* private fields */ }
Expand description
Wrapper around a Netlist or Layout, etc. into a Arc<RwLock<_>>
to provide
save read and write access. Access is checked at runtime.
If only read access is required, then it might be more efficient to use crate::reference_access
.
In contrast to the API of HierarchyBase
and others the object-like API avoids returning iterators
but returns vectors of elements. This allows to keep the lock-time short.
Implementations§
source§impl<T> RwRefAccess<T>
impl<T> RwRefAccess<T>
pub fn new(base: T) -> Self
sourcepub fn read(&self) -> RwLockReadGuard<'_, T>
pub fn read(&self) -> RwLockReadGuard<'_, T>
Get read access to the underlying data structure.
Blocks when called during an ongoing write access.
sourcepub fn write(&self) -> RwLockWriteGuard<'_, T>
pub fn write(&self) -> RwLockWriteGuard<'_, T>
Get exclusive write access to the underlying data structure.
Blocks if there is already a read or write lock.
§Panics
Might panic if the current thread already holds a write lock.
source§impl<H: HierarchyBase> RwRefAccess<H>
impl<H: HierarchyBase> RwRefAccess<H>
source§impl<H: HierarchyEdit> RwRefAccess<H>
impl<H: HierarchyEdit> RwRefAccess<H>
pub fn create_cell(&self, name: H::NameType) -> CellRef<H>
pub fn remove_cell(&self, cell: CellRef<H>)
Trait Implementations§
source§impl<T> Clone for RwRefAccess<T>
impl<T> Clone for RwRefAccess<T>
source§impl<T> Hash for RwRefAccess<T>
impl<T> Hash for RwRefAccess<T>
source§impl<T> PartialEq for RwRefAccess<T>
impl<T> PartialEq for RwRefAccess<T>
impl<T> Eq for RwRefAccess<T>
Auto Trait Implementations§
impl<T> Freeze for RwRefAccess<T>
impl<T> RefUnwindSafe for RwRefAccess<T>
impl<T> Send for RwRefAccess<T>
impl<T> Sync for RwRefAccess<T>
impl<T> Unpin for RwRefAccess<T>
impl<T> UnwindSafe for RwRefAccess<T>
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