Struct libreda_db::layout::layout::Layout [−][src]
Data structure which holds cells and cell instances.
Examples
use libreda_db::prelude::*; let mut layout = Layout::new();
Fields
dbu: UInt
Data-base unit. Pixels per micrometer.
Implementations
impl Layout
[src]
pub fn new() -> Self
[src]
Create a new and empty layout.
pub fn create_cell<S: Into<String>>(
&mut self,
cell_name: Option<S>
) -> CellIndex
[src]
&mut self,
cell_name: Option<S>
) -> CellIndex
Create a new cell in this layout. Returns: Returns a handle to this cell.
Examples
use libreda_db::prelude::*; let mut layout = Layout::new(); // Create a cell and get it's index. let top_cell_index: CellIndex = layout.create_cell(Some("Top"));
pub fn create_and_get_cell<S: Into<String>>(
&mut self,
cell_name: Option<S>
) -> Rc<Cell<Coord>>
[src]
&mut self,
cell_name: Option<S>
) -> Rc<Cell<Coord>>
Create a new cell in this layout. Returns: Returns a reference to this cell.
Examples
use libreda_db::prelude::*; let mut layout = Layout::new(); // Create a cell and directly get the index. let top_cell_ref = layout.create_and_get_cell(Some("Top"));
pub fn cell_index_by_name<S: ?Sized>(&self, cell_name: &S) -> Option<CellIndex> where
String: Borrow<S>,
S: Hash + Eq,
[src]
String: Borrow<S>,
S: Hash + Eq,
Find a cell index by the cell name.
Returns None
if the cell name does not exist.
pub fn cell_by_index(&self, cell_index: CellIndex) -> Option<Rc<Cell<Coord>>>
[src]
Find a cell by its index.
Examples
use libreda_db::prelude::*; let mut layout = Layout::new(); // Create a cell and get it's index. let top_cell_index: CellIndex = layout.create_cell(Some("Top")); // Get the reference to the cell by the index. let top_cell_ref = layout.cell_by_index(top_cell_index).unwrap(); // Access the cell by the reference. assert_eq!(top_cell_ref.name().unwrap(), "Top");
pub fn cell_by_name<S: ?Sized>(&self, cell_name: &S) -> Option<Rc<Cell<Coord>>> where
String: Borrow<S>,
S: Hash + Eq,
[src]
String: Borrow<S>,
S: Hash + Eq,
Find a cell by its name.
Returns None
if there is no such cell.
Examples
use libreda_db::prelude::*; let mut layout = Layout::new(); // Create a cell and get it's index. let top_cell_index: CellIndex = layout.create_cell(Some("Top")); // Get the reference to the cell by the index. let top_cell_ref = layout.cell_by_name("Top").unwrap(); // Access the cell by the reference. assert_eq!(top_cell_ref.name().unwrap(), "Top");
pub fn rename_cell<S: Into<String>>(
&mut self,
cell_index: CellIndex,
new_name: Option<S>
) -> Result<(), LayoutDbError>
[src]
&mut self,
cell_index: CellIndex,
new_name: Option<S>
) -> Result<(), LayoutDbError>
Change the name of a cell. The name is not allowed to already exist. Returns an error if the cell index is not found or the new name collides with an existing name.
Examples
use libreda_db::prelude::*; let mut layout = Layout::new(); // Create a cell and get it's index. let a_cell_index: CellIndex = layout.create_cell(Some("A")); layout.rename_cell(a_cell_index, Some("B")); // Now a cell with name `A` does not exist anymore. assert!(layout.cell_by_name("A").is_none()); // Get the reference to the cell by the index. let top_cell_ref = layout.cell_by_name("B").unwrap(); // Access the cell by the reference. assert_eq!(top_cell_ref.name().unwrap(), "B");
pub fn get_or_create_cell_by_name(&mut self, cell_name: &str) -> CellIndex
[src]
Find a cell by name or create it if it does not exist.
pub fn each_cell(
&self
) -> impl Iterator<Item = &Rc<Cell<Coord>>> + ExactSizeIterator
[src]
&self
) -> impl Iterator<Item = &Rc<Cell<Coord>>> + ExactSizeIterator
Get an iterator over all cells.
pub fn has_cell<S: ?Sized>(&self, cell_name: &S) -> bool where
String: Borrow<S>,
S: Hash + Eq,
[src]
String: Borrow<S>,
S: Hash + Eq,
Returns true iff a cell with this name exists.
pub fn num_cells(&self) -> usize
[src]
Get the total number of cells in this layout.
pub fn find_layer_by_name<S: ?Sized>(&self, name: &S) -> Option<LayerIndex> where
String: Borrow<S>,
S: Hash + Eq,
[src]
String: Borrow<S>,
S: Hash + Eq,
Find layer index by the name of the layer.
pub fn find_layer(&self, index: UInt, datatype: UInt) -> Option<LayerIndex>
[src]
Find layer index by the (index, data type) tuple.
pub fn find_or_create_layer(
&mut self,
index: UInt,
datatype: UInt
) -> LayerIndex
[src]
&mut self,
index: UInt,
datatype: UInt
) -> LayerIndex
Find layer index by the (index, data type) tuple or create a new layer index if nothing can be found.
pub fn get_layer_info(&self, layer_index: LayerIndex) -> Option<&LayerInfo>
[src]
Get the read-only layer info datastructure for the given layer.
pub fn get_layer_info_mut(
&mut self,
layer_index: LayerIndex
) -> Option<&mut LayerInfo>
[src]
&mut self,
layer_index: LayerIndex
) -> Option<&mut LayerInfo>
Get the mutable layer info datastructure for the given layer.
pub fn set_layer_name(&mut self, layer_index: LayerIndex, name: Option<String>)
[src]
Set the name of a layer. None
indicates that the layer has no name.
Trait Implementations
impl Debug for Layout
[src]
impl Default for Layout
[src]
impl WithProperties for Layout
[src]
type Key = String
Property key type.
fn with_properties<F, R>(&self, f: F) -> R where
F: FnOnce(Option<&PropertyStore<Self::Key>>) -> R,
[src]
F: FnOnce(Option<&PropertyStore<Self::Key>>) -> R,
fn with_properties_mut<F, R>(&self, f: F) -> R where
F: FnOnce(&mut PropertyStore<Self::Key>) -> R,
[src]
F: FnOnce(&mut PropertyStore<Self::Key>) -> R,
fn property<Q: ?Sized>(&self, key: &Q) -> Option<PropertyValue> where
Self::Key: Borrow<Q>,
Q: Eq + Hash,
[src]
Self::Key: Borrow<Q>,
Q: Eq + Hash,
fn property_str<Q: ?Sized>(&self, key: &Q) -> Option<Rc<String>> where
Self::Key: Borrow<Q>,
Q: Eq + Hash,
[src]
Self::Key: Borrow<Q>,
Q: Eq + Hash,
fn set_property<V: Into<PropertyValue>>(
&self,
key: Self::Key,
value: V
) -> Option<PropertyValue>
[src]
&self,
key: Self::Key,
value: V
) -> Option<PropertyValue>
Auto Trait Implementations
impl !RefUnwindSafe for Layout
impl !Send for Layout
impl !Sync for Layout
impl Unpin for Layout
impl !UnwindSafe for Layout
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,