Struct libreda_pnr::db::Layout [−][src]
Data structure which holds cells and cell instances.
Examples
use libreda_db::prelude::*; let mut layout = Layout::new();
Fields
dbu: u32
Data-base unit. Pixels per micrometer.
Implementations
impl Layout
[src]
pub fn new() -> Layout
[src]
Create a new and empty layout.
pub fn create_cell<S>(&mut self, cell_name: Option<S>) -> Index<Cell<i32>> where
S: Into<String>,
[src]
S: Into<String>,
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>(&mut self, cell_name: Option<S>) -> Rc<Cell<i32>> where
S: Into<String>,
[src]
S: Into<String>,
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>(&self, cell_name: &S) -> Option<Index<Cell<i32>>> where
S: Hash + Eq + ?Sized,
String: Borrow<S>,
[src]
S: Hash + Eq + ?Sized,
String: Borrow<S>,
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: Index<Cell<i32>>
) -> Option<Rc<Cell<i32>>>
[src]
&self,
cell_index: Index<Cell<i32>>
) -> Option<Rc<Cell<i32>>>
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>(&self, cell_name: &S) -> Option<Rc<Cell<i32>>> where
S: Hash + Eq + ?Sized,
String: Borrow<S>,
[src]
S: Hash + Eq + ?Sized,
String: Borrow<S>,
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>(
&mut self,
cell_index: Index<Cell<i32>>,
new_name: Option<S>
) -> Result<(), LayoutDbError> where
S: Into<String>,
[src]
&mut self,
cell_index: Index<Cell<i32>>,
new_name: Option<S>
) -> Result<(), LayoutDbError> where
S: Into<String>,
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
) -> Index<Cell<i32>>
[src]
&mut self,
cell_name: &str
) -> Index<Cell<i32>>
Find a cell by name or create it if it does not exist.
pub fn each_cell(
&self
) -> impl ExactSizeIterator + Iterator<Item = &Rc<Cell<i32>>>
[src]
&self
) -> impl ExactSizeIterator + Iterator<Item = &Rc<Cell<i32>>>
Get an iterator over all cells.
pub fn has_cell<S>(&self, cell_name: &S) -> bool where
S: Hash + Eq + ?Sized,
String: Borrow<S>,
[src]
S: Hash + Eq + ?Sized,
String: Borrow<S>,
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>(&self, name: &S) -> Option<Index<LayerInfo>> where
S: Hash + Eq + ?Sized,
String: Borrow<S>,
[src]
S: Hash + Eq + ?Sized,
String: Borrow<S>,
Find layer index by the name of the layer.
pub fn find_layer(&self, index: u32, datatype: u32) -> Option<Index<LayerInfo>>
[src]
Find layer index by the (index, data type) tuple.
pub fn find_or_create_layer(
&mut self,
index: u32,
datatype: u32
) -> Index<LayerInfo>
[src]
&mut self,
index: u32,
datatype: u32
) -> Index<LayerInfo>
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: Index<LayerInfo>
) -> Option<&LayerInfo>
[src]
&self,
layer_index: Index<LayerInfo>
) -> Option<&LayerInfo>
Get the read-only layer info datastructure for the given layer.
pub fn get_layer_info_mut(
&mut self,
layer_index: Index<LayerInfo>
) -> Option<&mut LayerInfo>
[src]
&mut self,
layer_index: Index<LayerInfo>
) -> Option<&mut LayerInfo>
Get the mutable layer info datastructure for the given layer.
pub fn set_layer_name(
&mut self,
layer_index: Index<LayerInfo>,
name: Option<String>
)
[src]
&mut self,
layer_index: Index<LayerInfo>,
name: Option<String>
)
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.
pub fn with_properties<F, R>(&self, f: F) -> R where
F: FnOnce(Option<&PropertyStore<<Layout as WithProperties>::Key>>) -> R,
[src]
F: FnOnce(Option<&PropertyStore<<Layout as WithProperties>::Key>>) -> R,
pub fn with_properties_mut<F, R>(&self, f: F) -> R where
F: FnOnce(&mut PropertyStore<<Layout as WithProperties>::Key>) -> R,
[src]
F: FnOnce(&mut PropertyStore<<Layout as WithProperties>::Key>) -> R,
pub fn property<Q>(&self, key: &Q) -> Option<PropertyValue> where
Q: Eq + Hash + ?Sized,
Self::Key: Borrow<Q>,
[src]
Q: Eq + Hash + ?Sized,
Self::Key: Borrow<Q>,
pub fn property_str<Q>(&self, key: &Q) -> Option<Rc<String>> where
Q: Eq + Hash + ?Sized,
Self::Key: Borrow<Q>,
[src]
Q: Eq + Hash + ?Sized,
Self::Key: Borrow<Q>,
pub fn set_property<V>(&self, key: Self::Key, value: V) -> Option<PropertyValue> where
V: Into<PropertyValue>,
[src]
V: Into<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>,