pub trait Part {
// Required methods
fn pin_changed(&mut self, pin: PinId, level: Level, now: Tick);
fn drive(&self, pin: PinId) -> Level;
// Provided methods
fn next_tick(&self) -> Option<Tick> { ... }
fn tick(&mut self, _now: Tick) { ... }
}Expand description
A schematic component. Parts never read MCU registers; they react to pin levels and to time, which is the same contract a real part has.
Required Methods§
Sourcefn pin_changed(&mut self, pin: PinId, level: Level, now: Tick)
fn pin_changed(&mut self, pin: PinId, level: Level, now: Tick)
Called for every level change on a pin this part is attached to.
Provided Methods§
Sourcefn next_tick(&self) -> Option<Tick>
fn next_tick(&self) -> Option<Tick>
Earliest tick at which this part wants Part::tick called again.
fn tick(&mut self, _now: Tick)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".