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

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::Ends point to outputs that exist - guaranteed if constructed with ComponentBuilder and used outputs from 0 up to the number of outputs
  • all Sequal::Gates 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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Safety

this function is only safe if:

  • input is the same length as the last sequals vector
  • all Sequal::Ends point to outputs that exist - guaranteed if constructed with ComponentBuilder and used outputs from 0 up to the number of outputs
  • all Sequal::Gates 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

This function resets the gate, if your gate needs to be reset between cpu tiks (I have no example) or between runs (for example memory)

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.