Struct logic_circus::Component [−][src]
pub struct Component<Rust = Infallible> { /* fields omitted */ }
Expand description
A circuit
use builder()
to construct
use compute to run the logic
stick inside a Gate::component
to use as part of a bigger component and
compose with other gates
put a gate implemented in rust (or an enum of them) in <Rust>
to use it
(or them)
Implementations
Aquire a ComponentBuilder
Create a component out of a single gate
this is mostly useless since the gate itself can probably do whatever you need and exists mostly for tests
Create a component from it’s raw parts
in sequals
each Vec<Sequal>
corresponds to a single gates sequals
(in the same index) and the last corresponds to the components inputs
outputs
is the amount of outputs your component has
Runs the component
This is an alias for compute
since that function
is inside a trait impl and thus way harder to find, also the name is
nice
Safety
this function is only safe if:
input
is the same length as the last sequals vector- all
Sequal::End
s point to outputs that exist - guaranteed if constructed withComponentBuilder
and used outputs from 0 up to the number of outputs - all
Sequal::Gate
s must point to actual inputs of actual gates - component is clean (right after construction or after a call to
Component::reset()
)
Resets the whole component
this must be done in between cpu ticks (calls to compute) in order for the gates to work (otherwise the code is panicks in debug and is unsound in release)
a full reset is done in between runs, this is to reset things like memory that are kept between ticks
Trait Implementations
Safety
this function is only safe if:
input
is the same length as the last sequals vector- all
Sequal::End
s point to outputs that exist - guaranteed if constructed withComponentBuilder
and used outputs from 0 up to the number of outputs - all
Sequal::Gate
s must point to actual inputs of actual gates - component is clean (right after construction or after a call to
Component::reset()
)
This function counts the amount of inputs a gate has Read more
Auto Trait Implementations
impl<Rust> RefUnwindSafe for Component<Rust> where
Rust: RefUnwindSafe,
impl<Rust> UnwindSafe for Component<Rust> where
Rust: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more