Network

Trait Network 

Source
pub trait Network {
    type Node: NetworkNode<NodeId = Self::Signal>;
    type NodeId: Clone + PartialEq + Eq + Hash + Send + Sync + Debug + 'static;
    type Signal: Copy + Clone + PartialEq + Eq + Hash + Send + Sync + Debug + 'static;
    type LogicValue: LogicValue;
    type NodeFunction: BooleanFunction;

Show 16 methods // Required methods fn foreach_gate(&self, f: impl Fn(Self::Signal)); fn foreach_node(&self, f: impl Fn(&Self::Node)); fn get_constant(&self, value: Self::LogicValue) -> Self::Signal; fn get_constant_value( &self, signal: Self::Signal, ) -> Option<Self::LogicValue>; fn get_node_input( &self, node: &Self::NodeId, input_index: usize, ) -> Self::Signal; fn get_node_output(&self, node: &Self::NodeId) -> Self::Signal; fn get_source_node(&self, signal: &Self::Signal) -> Self::NodeId; fn get_primary_input(&self, index: usize) -> Self::Signal; fn get_primary_output(&self, index: usize) -> Self::Signal; fn is_input(&self, signal: Self::Signal) -> bool; fn node_function(&self, node: Self::NodeId) -> Self::NodeFunction; fn num_gates(&self) -> usize; fn num_node_inputs(&self, node: &Self::NodeId) -> usize; fn num_primary_inputs(&self) -> usize; fn num_primary_outputs(&self) -> usize; // Provided method fn is_constant(&self, signal: Self::Signal) -> bool { ... }
}
Expand description

Basic properties of a logic network.

Required Associated Types§

Source

type Node: NetworkNode<NodeId = Self::Signal>

Type of the logic node.

Source

type NodeId: Clone + PartialEq + Eq + Hash + Send + Sync + Debug + 'static

Identifier of a logic node in this network.

Source

type Signal: Copy + Clone + PartialEq + Eq + Hash + Send + Sync + Debug + 'static

Type which represents the outputs of network nodes, e.g. signals. In contrast to a NodeId a Signal might also encode a logic inversion.

Source

type LogicValue: LogicValue

Type of signal values. Typically this might be bool.

Source

type NodeFunction: BooleanFunction

Type which represents the logic function of nodes in the network.

Required Methods§

Source

fn foreach_gate(&self, f: impl Fn(Self::Signal))

Visit all network gates in an undefined order. Each gate is visited exactly once.

Source

fn foreach_node(&self, f: impl Fn(&Self::Node))

Visit all logic nodes.

Source

fn get_constant(&self, value: Self::LogicValue) -> Self::Signal

Get a graph signal which represents the constant value.

Source

fn get_constant_value(&self, signal: Self::Signal) -> Option<Self::LogicValue>

Get the value of a signal if it is a constant.

Source

fn get_node_input( &self, node: &Self::NodeId, input_index: usize, ) -> Self::Signal

Get an input value of a node.

Source

fn get_node_output(&self, node: &Self::NodeId) -> Self::Signal

Get the output signal of a node.

Source

fn get_source_node(&self, signal: &Self::Signal) -> Self::NodeId

Get the node which computes a signal.

Source

fn get_primary_input(&self, index: usize) -> Self::Signal

Get a primary input by its index.

Source

fn get_primary_output(&self, index: usize) -> Self::Signal

Get a primary output by its index.

Source

fn is_input(&self, signal: Self::Signal) -> bool

Check if the signal is a primary input.

Source

fn node_function(&self, node: Self::NodeId) -> Self::NodeFunction

Get the logic function implemented by the given node.

Source

fn num_gates(&self) -> usize

Number of gates present in the network.

Source

fn num_node_inputs(&self, node: &Self::NodeId) -> usize

Number of inputs into the given node.

Source

fn num_primary_inputs(&self) -> usize

Number of input into the network.

Source

fn num_primary_outputs(&self) -> usize

Number of outputs from the network.

Provided Methods§

Source

fn is_constant(&self, signal: Self::Signal) -> bool

Tell if the signal is directly connected to a constant.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<N: Network + ?Sized> Network for &N

Source§

type Node = <N as Network>::Node

Type of the logic node.

Source§

type NodeId = <N as Network>::NodeId

Identifier of a logic node in this network.

Source§

type Signal = <N as Network>::Signal

Type which represents the outputs of network nodes, e.g. signals. In contrast to a NodeId a Signal might also encode a logic inversion.

Source§

type LogicValue = <N as Network>::LogicValue

Type of signal values. Typically this might be bool.

Source§

type NodeFunction = <N as Network>::NodeFunction

Type which represents the logic function of nodes in the network.

Source§

fn foreach_gate(&self, f: impl Fn(Self::Signal))

Source§

fn foreach_node(&self, f: impl Fn(&Self::Node))

Source§

fn get_constant(&self, value: Self::LogicValue) -> Self::Signal

Source§

fn get_constant_value(&self, signal: Self::Signal) -> Option<Self::LogicValue>

Source§

fn get_node_input( &self, node: &Self::NodeId, input_index: usize, ) -> Self::Signal

Source§

fn get_node_output(&self, node: &Self::NodeId) -> Self::Signal

Source§

fn get_source_node(&self, signal: &Self::Signal) -> Self::NodeId

Source§

fn get_primary_input(&self, index: usize) -> Self::Signal

Source§

fn get_primary_output(&self, index: usize) -> Self::Signal

Source§

fn is_constant(&self, signal: Self::Signal) -> bool

Source§

fn is_input(&self, signal: Self::Signal) -> bool

Source§

fn node_function(&self, node: Self::NodeId) -> Self::NodeFunction

Source§

fn num_gates(&self) -> usize

Source§

fn num_node_inputs(&self, node: &Self::NodeId) -> usize

Source§

fn num_primary_inputs(&self) -> usize

Source§

fn num_primary_outputs(&self) -> usize

Source§

impl<N: Network + ?Sized> Network for &mut N

Source§

type Node = <N as Network>::Node

Type of the logic node.

Source§

type NodeId = <N as Network>::NodeId

Identifier of a logic node in this network.

Source§

type Signal = <N as Network>::Signal

Type which represents the outputs of network nodes, e.g. signals. In contrast to a NodeId a Signal might also encode a logic inversion.

Source§

type LogicValue = <N as Network>::LogicValue

Type of signal values. Typically this might be bool.

Source§

type NodeFunction = <N as Network>::NodeFunction

Type which represents the logic function of nodes in the network.

Source§

fn foreach_gate(&self, f: impl Fn(Self::Signal))

Source§

fn foreach_node(&self, f: impl Fn(&Self::Node))

Source§

fn get_constant(&self, value: Self::LogicValue) -> Self::Signal

Source§

fn get_constant_value(&self, signal: Self::Signal) -> Option<Self::LogicValue>

Source§

fn get_node_input( &self, node: &Self::NodeId, input_index: usize, ) -> Self::Signal

Source§

fn get_node_output(&self, node: &Self::NodeId) -> Self::Signal

Source§

fn get_source_node(&self, signal: &Self::Signal) -> Self::NodeId

Source§

fn get_primary_input(&self, index: usize) -> Self::Signal

Source§

fn get_primary_output(&self, index: usize) -> Self::Signal

Source§

fn is_constant(&self, signal: Self::Signal) -> bool

Source§

fn is_input(&self, signal: Self::Signal) -> bool

Source§

fn node_function(&self, node: Self::NodeId) -> Self::NodeFunction

Source§

fn num_gates(&self) -> usize

Source§

fn num_node_inputs(&self, node: &Self::NodeId) -> usize

Source§

fn num_primary_inputs(&self) -> usize

Source§

fn num_primary_outputs(&self) -> usize

Implementors§