[−][src]Struct logicsim::graph::InitializedGateGraph
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]
&mut self,
levers: &[LeverHandle],
values: I
)
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]
Auto Trait Implementations
impl RefUnwindSafe for InitializedGateGraph
impl Send for InitializedGateGraph
impl Sync for InitializedGateGraph
impl Unpin for InitializedGateGraph
impl UnwindSafe for InitializedGateGraph
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,