pub trait Block:
Hash
+ Eq
+ Send
+ Sync
+ Any {
type Io: Io;
// Required method
fn io(&self) -> Self::Io;
// Provided method
fn name(&self) -> ArcStr { ... }
}
Expand description
A block that can be instantiated by Substrate.
§Examples
#[derive(Io, Clone, Default, Debug)]
pub struct InverterIo {
pub vdd: InOut<Signal>,
pub vss: InOut<Signal>,
pub din: Input<Signal>,
pub dout: Output<Signal>,
}
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct Inverter {
strength: usize,
}
impl Block for Inverter {
type Io = InverterIo;
fn name(&self) -> arcstr::ArcStr {
arcstr::format!("inverter_{}", self.strength)
}
fn io(&self) -> Self::Io {
Default::default()
}
}
Required Associated Types§
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.