libreda_db/rw_reference_access/
mod.rs

1// Copyright (c) 2020-2021 Thomas Kramer.
2// SPDX-FileCopyrightText: 2022 Thomas Kramer
3//
4// SPDX-License-Identifier: AGPL-3.0-or-later
5
6//! # Experimental
7//! Wrapper around the [`trait@crate::traits::HierarchyBase`], [`trait@crate::traits::NetlistBase`], [`trait@crate::traits::LayoutBase`] and [`trait@crate::traits::L2NBase`] traits which
8//! provide object like access methods.
9//! In contrast to [`crate::reference_access`] this wrapper takes ownership of the underlying data structure
10//! and hence also allows write access.
11//! # Examples
12//!
13//! ```
14//! use libreda_db::prelude::*;
15//! use libreda_db::rw_reference_access::*;
16//!
17//! // Create some netlist/layout.
18//! let mut chip = RwRefAccess::new(Chip::new());
19//! let top = chip.create_cell("TOP".into());
20//! let sub = chip.create_cell("SUB".into());
21//! let sub_inst1 = top.create_instance(&sub, Some("inst1".into()));
22//!
23//! // `top` can now be used like an object to navigate the cell hierarchy, layout and netlist.
24//! for subcell in top.each_cell_instance() {
25//!     println!("{} contains {:?} which is a {}", top.name(), subcell.name(), subcell.template().name());
26//! }
27//!
28//! ```
29
30pub mod hierarchy_reference_access;
31
32pub use hierarchy_reference_access::*;