pub struct RwRefAccess<T> {
    base: Arc<RwLock<T>>,
}
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.

Fields§

§base: Arc<RwLock<T>>

Implementations§

source§

impl<T> RwRefAccess<T>

source

pub fn new(base: T) -> Self

source

pub fn read(&self) -> RwLockReadGuard<'_, T>

Get read access to the underlying data structure.

Panics

Panics when called during an ongoing write access.

source

pub fn write(&self) -> RwLockWriteGuard<'_, T>

Get exclusive write access to the underlying data structure.

Panics

Panics when called during an ongoing read or write access.

source§

impl<H: HierarchyBase> RwRefAccess<H>

source

fn cell(&self, id: H::CellId) -> CellRef<H>

Get a cell ‘object’ by its ID.

source

fn cell_inst(&self, id: H::CellInstId) -> CellInstRef<H>

Get a cell instance ‘object’ by its ID.

source

pub fn each_cell(&self) -> Vec<CellRef<H>>

Get a vector with all cells.

source

pub fn num_cells(&self) -> usize

Get the number of cells.

source

pub fn cell_by_name(&self, name: &str) -> Option<CellRef<H>>

Find a cell by its name.

source§

impl<H: HierarchyEdit> RwRefAccess<H>

source

pub fn create_cell(&self, name: H::NameType) -> CellRef<H>

source

pub fn remove_cell(&self, cell: CellRef<H>)

Trait Implementations§

source§

impl<T> Clone for RwRefAccess<T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Hash for RwRefAccess<T>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T> PartialEq<RwRefAccess<T>> for RwRefAccess<T>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Eq for RwRefAccess<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for RwRefAccess<T>

§

impl<T> Send for RwRefAccess<T>where T: Send + Sync,

§

impl<T> Sync for RwRefAccess<T>where T: Send + Sync,

§

impl<T> Unpin for RwRefAccess<T>

§

impl<T> UnwindSafe for RwRefAccess<T>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.