Struct libreda_pnr::db::Layout[][src]

pub struct Layout {
    pub dbu: u32,
    // some fields omitted
}

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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.

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.