ComponentBuilder

Struct ComponentBuilder 

Source
pub struct ComponentBuilder<Rust = Infallible> { /* private fields */ }
Expand description

The constructor for Component

you create one with Component::builder()

use gate to add another inner gate

use inputs to set the input locations and finalize construction (get your final Component)

put a gate implemented in rust (or an enum of them) in <Rust> to use it (or them)

Implementations§

Source§

impl<Rust> ComponentBuilder<Rust>

Source

pub fn gate(self, gate: Gate<Rust>, sequals: Vec<Sequal>) -> Self

Add a gate to the component

gate is the gate you want to add.

sequals dictate where the outputs of the gate go, in other words the wiring, these sequals are in order, so the gate’s first output will go to the first sequal and so on.

a sequal can either be another gate or one of the components outputs.

if you want to send an output to several places it must be done indirectly, you should take a look at Gate::dup.

Source

pub fn inputs(self, inputs: Vec<Sequal>) -> Component<Rust>

Tell the component where it’s inputs should go

after you’ve added many gates to your component you still need to tell the component where to start, once you do that your component is ready and it will be returned from the function

Trait Implementations§

Source§

impl<Rust> Default for ComponentBuilder<Rust>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<Rust> Freeze for ComponentBuilder<Rust>

§

impl<Rust> RefUnwindSafe for ComponentBuilder<Rust>
where Rust: RefUnwindSafe,

§

impl<Rust> Send for ComponentBuilder<Rust>
where Rust: Send,

§

impl<Rust> Sync for ComponentBuilder<Rust>
where Rust: Sync,

§

impl<Rust> Unpin for ComponentBuilder<Rust>
where Rust: Unpin,

§

impl<Rust> UnwindSafe for ComponentBuilder<Rust>
where Rust: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.