[][src]Struct logicsim::graph::InitializedGateGraph

pub struct InitializedGateGraph { /* fields omitted */ }

Initialized version of GateGraphBuilder. See GateGraphBuilder for documentation.

Implementations

impl InitializedGateGraph[src]

pub fn tick(&mut self) -> bool[src]

Propagates pending state changes through the graph. These could be levers that have been updated or loops. Returns true if the graph has reached a stable state.

pub fn run_until_stable(&mut self, max: usize) -> Result<usize, &'static str>[src]

Calls InitializedGateGraph::tick until it returns true a maximum of max times. Returns Ok(number_of_iterations) if the graph stabilized. Returns Err(&str) otherwise.

Circuits might not stabilize if they have infinite loops like a chain of 3 not gates.

pub fn update_levers<I: Iterator<Item = bool>>(
    &mut self,
    levers: &[LeverHandle],
    values: I
)
[src]

Sets the state of all levers to their corresponding values and calls InitializedGateGraph::tick once.

pub fn update_lever(&mut self, lever: LeverHandle, value: bool)[src]

Sets the state of lever to value and calls InitializedGateGraph::tick once.

pub fn set_lever(&mut self, lever: LeverHandle)[src]

Sets the state of lever to true and calls InitializedGateGraph::tick once.

pub fn reset_lever(&mut self, lever: LeverHandle)[src]

Sets the state of lever to false and calls InitializedGateGraph::tick once.

pub fn flip_lever(&mut self, lever: LeverHandle)[src]

Sets the state of lever to the opposite of its current state and calls InitializedGateGraph::tick once.

pub fn pulse_lever(&mut self, lever: LeverHandle)[src]

Sets the state of lever to true, calls tick, then sets the state of lever to false and calls tick again.

pub fn set_lever_stable(&mut self, lever: LeverHandle)[src]

Sets the state of lever to true and calls run_until_stable, with DEFAULT_STABLE_MAX.

Panics

Will panic if the circuit does not stabilize

pub fn reset_lever_stable(&mut self, lever: LeverHandle)[src]

Sets the state of lever to false and calls run_until_stable, with DEFAULT_STABLE_MAX.

Panics

Will panic if the circuit does not stabilize

pub fn flip_lever_stable(&mut self, lever: LeverHandle)[src]

Sets the state of lever to the opposite of its current state and calls run_until_stable, with DEFAULT_STABLE_MAX.

Panics

Will panic if the circuit does not stabilize

pub fn pulse_lever_stable(&mut self, lever: LeverHandle)[src]

Sets the state of lever to true, calls run_until_stable(DEFAULT_STABLE_MAX), then sets the state of lever to false and calls run_until_stable(DEFAULT_STABLE_MAX) again.

Panics

Will panic if the circuit does not stabilize

pub fn collect_char_lossy(&self, outputs: &[GateIndex]) -> char[src]

Returns the corresponding type by collecting its bits from outputs. If more bits are provided, the value is truncated. If less bits are provided, the value is 0 extended.

pub fn len(&self) -> usize[src]

Returns the number of gates in the graph.

pub fn dump_dot(&self, filename: &'static str)[src]

Dumps the graph in dot format to path filename, to be visualized by many supported tools, I recommend gephi.

Auto Trait Implementations

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.