pub struct NetRef<I>where
I: Instantiable,{ /* private fields */ }Expand description
Provides an idiomatic interface to the interior mutability of the netlist
Implementations§
Source§impl<I> NetRef<I>where
I: Instantiable,
impl<I> NetRef<I>where
I: Instantiable,
Sourcepub fn as_net_mut(&self) -> RefMut<'_, Net>
pub fn as_net_mut(&self) -> RefMut<'_, Net>
Sourcepub fn get_net(&self, idx: usize) -> Ref<'_, Net>
pub fn get_net(&self, idx: usize) -> Ref<'_, Net>
Returns a borrow to the output Net as position idx
Sourcepub fn get_net_mut(&self, idx: usize) -> RefMut<'_, Net>
pub fn get_net_mut(&self, idx: usize) -> RefMut<'_, Net>
Returns a mutable borrow to the output Net as position idx
Sourcepub fn get_output(&self, idx: usize) -> DrivenNet<I>
pub fn get_output(&self, idx: usize) -> DrivenNet<I>
Returns a borrow to the output Net as position idx
Sourcepub fn find_output(&self, id: &Identifier) -> Option<DrivenNet<I>>
pub fn find_output(&self, id: &Identifier) -> Option<DrivenNet<I>>
Returns a borrow to the output connected to port id
Sourcepub fn get_input(&self, idx: usize) -> InputPort<I>
pub fn get_input(&self, idx: usize) -> InputPort<I>
Returns an abstraction around the input connection
Sourcepub fn find_input(&self, id: &Identifier) -> Option<InputPort<I>>
pub fn find_input(&self, id: &Identifier) -> Option<InputPort<I>>
Returns a borrow to the input port with name id
Sourcepub fn get_identifier(&self) -> Identifier
pub fn get_identifier(&self) -> Identifier
Returns the name of the net at this circuit node.
§Panics
Panics if the circuit node has multiple outputs.
Sourcepub fn set_identifier(&self, identifier: Identifier)
pub fn set_identifier(&self, identifier: Identifier)
Changes the identifier of the net at this circuit node.
§Panics
Panics if the circuit node has multiple outputs.
Sourcepub fn is_an_input(&self) -> bool
pub fn is_an_input(&self) -> bool
Returns true if this circuit node is a principal input
Sourcepub fn get_instance_type(&self) -> Option<Ref<'_, I>>
pub fn get_instance_type(&self) -> Option<Ref<'_, I>>
Returns the Instantiable type of the instance, if this circuit node is an instance
Sourcepub fn get_instance_type_mut(&self) -> Option<RefMut<'_, I>>
pub fn get_instance_type_mut(&self) -> Option<RefMut<'_, I>>
Returns the Instantiable type of the instance, if this circuit node is an instance
Sourcepub fn get_instance_name(&self) -> Option<Identifier>
pub fn get_instance_name(&self) -> Option<Identifier>
Returns a copy of the name of the instance, if the circuit node is a instance.
Sourcepub fn set_instance_name(&self, name: Identifier)
pub fn set_instance_name(&self, name: Identifier)
Updates the name of the instance, if the circuit node is an instance.
§Panics
Panics if the circuit node is a principal input.
Sourcepub fn expose_as_output(self) -> Result<Self, Error>
pub fn expose_as_output(self) -> Result<Self, Error>
Exposes this circuit node as a top-level output in the netlist. Returns an error if the circuit node is a principal input.
§Panics
Panics if cell is a multi-output circuit node. Panics if the reference to the netlist is lost.
Sourcepub fn expose_with_name(self, name: Identifier) -> Self
pub fn expose_with_name(self, name: Identifier) -> Self
Exposes this circuit node as a top-level output in the netlist with a specific port name.
§Panics
Panics if the cell is a multi-output circuit node. Panics if the reference to the netlist is lost.
Sourcepub fn expose_net(&self, net: &Net) -> Result<(), Error>
pub fn expose_net(&self, net: &Net) -> Result<(), Error>
Exposes the net driven by this circuit node as a top-level output.
Errors if net is not driven by this circuit node.
§Panics
Panics if the reference to the netlist is lost.
Sourcepub fn get_driver(&self, index: usize) -> Option<Self>
pub fn get_driver(&self, index: usize) -> Option<Self>
Returns the circuit node that drives the indexth input
Sourcepub fn get_driver_net(&self, index: usize) -> Option<Net>
pub fn get_driver_net(&self, index: usize) -> Option<Net>
Returns the net that drives the indexth input
§Panics
Panics if the reference to the netlist is lost.
Sourcepub fn req_driver_net(&self, index: usize) -> Option<MutBorrowReq<I>>
pub fn req_driver_net(&self, index: usize) -> Option<MutBorrowReq<I>>
Returns a request to mutably borrow the operand net This requires another borrow in the form of MutBorrowReq
§Panics
Panics if the reference to the netlist is lost.
Sourcepub fn get_num_input_ports(&self) -> usize
pub fn get_num_input_ports(&self) -> usize
Returns the number of input ports for this circuit node.
Sourcepub fn is_fully_connected(&self) -> bool
pub fn is_fully_connected(&self) -> bool
Returns true if this circuit node has all its input ports connected.
Sourcepub fn drivers(&self) -> impl Iterator<Item = Option<Self>>
pub fn drivers(&self) -> impl Iterator<Item = Option<Self>>
Returns an iterator to the driving circuit nodes.
Sourcepub fn driver_nets(&self) -> impl Iterator<Item = Option<Net>>
pub fn driver_nets(&self) -> impl Iterator<Item = Option<Net>>
Returns an interator to the driving nets.
Sourcepub fn nets(&self) -> impl Iterator<Item = Net>
pub fn nets(&self) -> impl Iterator<Item = Net>
Returns an iterator to the output nets of this circuit node.
Sourcepub fn inputs(&self) -> impl Iterator<Item = InputPort<I>>
pub fn inputs(&self) -> impl Iterator<Item = InputPort<I>>
Returns an iterator to the output nets of this circuit node, along with port information.
Sourcepub fn outputs(&self) -> impl Iterator<Item = DrivenNet<I>>
pub fn outputs(&self) -> impl Iterator<Item = DrivenNet<I>>
Returns an iterator to the output nets of this circuit node, along with port information.
Sourcepub fn nets_mut(&self) -> impl Iterator<Item = RefMut<'_, Net>>
pub fn nets_mut(&self) -> impl Iterator<Item = RefMut<'_, Net>>
Returns an iterator to mutate the output nets of this circuit node.
Sourcepub fn drives_net(&self, net: &Net) -> bool
pub fn drives_net(&self, net: &Net) -> bool
Returns true if this circuit node drives the given net.
Sourcepub fn drives_a_top_output(&self) -> bool
pub fn drives_a_top_output(&self) -> bool
Returns true if this circuit node drives a top-level output.
§Panics
Panics if the weak reference to the netlist is lost.
Sourcepub fn find_net_mut(&self, net: &Net) -> Option<RefMut<'_, Net>>
pub fn find_net_mut(&self, net: &Net) -> Option<RefMut<'_, Net>>
Attempts to find a mutable reference to net within this circuit node.
Sourcepub fn is_multi_output(&self) -> bool
pub fn is_multi_output(&self) -> bool
Returns true if this circuit node has multiple outputs/nets.
Sourcepub fn delete_uses(self) -> Result<Object<I>, Error>
pub fn delete_uses(self) -> Result<Object<I>, Error>
Deletes the uses of this circuit node from the netlist.
§Panics
Panics if the reference to the netlist is lost.
Sourcepub fn replace_uses_with(self, other: &DrivenNet<I>) -> Result<Object<I>, Error>
pub fn replace_uses_with(self, other: &DrivenNet<I>) -> Result<Object<I>, Error>
Replaces the uses of this circuit node in the netlist with another circuit node.
§Panics
Panics if either self is a multi-output circuit node.
Panics if the weak reference to the netlist is lost.
Sourcepub fn clear_attribute(&self, k: &AttributeKey) -> Option<AttributeValue>
pub fn clear_attribute(&self, k: &AttributeKey) -> Option<AttributeValue>
Clears the attribute with the given key on this circuit node.
Sourcepub fn set_attribute(&self, k: AttributeKey)
pub fn set_attribute(&self, k: AttributeKey)
Set an attribute without a value
Sourcepub fn insert_attribute(
&self,
k: AttributeKey,
v: String,
) -> Option<AttributeValue>
pub fn insert_attribute( &self, k: AttributeKey, v: String, ) -> Option<AttributeValue>
Insert an attribute on this node with a value
Sourcepub fn attributes(&self) -> impl Iterator<Item = Attribute>
pub fn attributes(&self) -> impl Iterator<Item = Attribute>
Returns an iterator to the attributes at this circuit node
Trait Implementations§
Source§impl<I> Debug for NetRef<I>where
I: Instantiable,
impl<I> Debug for NetRef<I>where
I: Instantiable,
Source§impl<I> Display for NetRef<I>where
I: Instantiable,
impl<I> Display for NetRef<I>where
I: Instantiable,
Source§impl<I> Hash for NetRef<I>where
I: Instantiable,
impl<I> Hash for NetRef<I>where
I: Instantiable,
Source§impl<I> PartialEq for NetRef<I>where
I: Instantiable,
impl<I> PartialEq for NetRef<I>where
I: Instantiable,
impl<I> Eq for NetRef<I>where
I: Instantiable,
Auto Trait Implementations§
impl<I> Freeze for NetRef<I>
impl<I> !RefUnwindSafe for NetRef<I>
impl<I> !Send for NetRef<I>
impl<I> !Sync for NetRef<I>
impl<I> Unpin for NetRef<I>
impl<I> !UnwindSafe for NetRef<I>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.