Struct libreda_db::layout::layout::Layout[][src]

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

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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.

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.