[][src]Struct kaze::Instance

#[must_use]pub struct Instance<'a> { /* fields omitted */ }

An instance of a Module, created by the Module::instance method.

Examples

use kaze::*;

let c = Context::new();

// Inner module (simple pass-through)
let inner = c.module("Inner");
inner.output("o", inner.input("i", 32));

// Outer module (wraps a single `Inner` instance)
let outer = c.module("Outer");
let inner_inst = outer.instance("inner_inst", "Inner");
inner_inst.drive_input("i", outer.input("i", 32));
outer.output("o", inner_inst.output("o"));

Implementations

impl<'a> Instance<'a>[src]

pub fn drive_input<S: Into<String>>(&'a self, name: S, i: &'a Signal<'a>)[src]

Drives the input of this Module Instance specified by name with the given Signal.

Panics

Panics if i is from a different Module than self, if name specifies an input that doesn't exist on this Instance's Module, if this input is already driven on this Instance, or if i's bit width differs from that of the input.

Examples

use kaze::*;

let c = Context::new();

let inner = c.module("Inner");
inner.output("o", inner.input("i", 32));

let outer = c.module("Outer");
let inner_inst = outer.instance("inner_inst", "Inner");
// Drive inner_inst's "i" input with a 32-bit literal
inner_inst.drive_input("i", outer.lit(0xfadebabeu32, 32));

pub fn output<S: Into<String>>(&'a self, name: S) -> &Signal<'a>[src]

Creates a Signal that represents this Instance's output called name.

Panics

Panics if name specifies an output that doesn't exist on this Instance's Module.

Examples

use kaze::*;

let c = Context::new();

let inner = c.module("Inner");
inner.output("o", inner.lit(true, 1));

let outer = c.module("Outer");
let inner_inst = outer.instance("inner_inst", "Inner");
// Forward inner_inst's "o" output to a new output on outer with the same name
outer.output("o", inner_inst.output("o"));

Trait Implementations

impl<'a> Eq for &'a Instance<'a>[src]

impl<'a> Hash for &'a Instance<'a>[src]

impl<'a> PartialEq<&'a Instance<'a>> for &'a Instance<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Instance<'a>[src]

impl<'a> !Send for Instance<'a>[src]

impl<'a> !Sync for Instance<'a>[src]

impl<'a> Unpin for Instance<'a>[src]

impl<'a> !UnwindSafe for Instance<'a>[src]

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.