pub struct Signal { /* private fields */ }
Expand description
A diagram signal line with a set of cycles.
Implementations§
source§impl Signal
impl Signal
sourcepub fn with(
name: String,
cycles: Vec<CycleState>,
data: Vec<String>,
node: String,
period: u16,
phase: CycleOffset
) -> Self
pub fn with( name: String, cycles: Vec<CycleState>, data: Vec<String>, node: String, period: u16, phase: CycleOffset ) -> Self
Create a new Signal
with a set of parameters.
sourcepub fn with_cycle_str(states: impl AsRef<str>) -> Self
pub fn with_cycle_str(states: impl AsRef<str>) -> Self
Create a new Signal
with the cycles formed from the states
string.
sourcepub fn add_cycles(self, cycles: impl IntoIterator<Item = CycleState>) -> Self
pub fn add_cycles(self, cycles: impl IntoIterator<Item = CycleState>) -> Self
Add a set of CycleState
s to the Signal
.
sourcepub fn add_cycle(self, cycle: CycleState) -> Self
pub fn add_cycle(self, cycle: CycleState) -> Self
Add a CycleState
to the Signal
.
sourcepub fn add_n_cycles(self, n: usize, cycle: CycleState) -> Self
pub fn add_n_cycles(self, n: usize, cycle: CycleState) -> Self
Add a CycleState
to repeat n
times to the Signal
.
sourcepub fn add_data_fields(
self,
fields: impl IntoIterator<Item = impl Into<String>>
) -> Self
pub fn add_data_fields( self, fields: impl IntoIterator<Item = impl Into<String>> ) -> Self
sourcepub fn add_data_field(self, data: impl Into<String>) -> Self
pub fn add_data_field(self, data: impl Into<String>) -> Self
Add a data field to the Signal
.
This is used to fill up a container state, such as the CycleState::Data
or
CycleState::Box2
, with text.
sourcepub fn repeated(state: CycleState, repeats: usize) -> Self
pub fn repeated(state: CycleState, repeats: usize) -> Self
Create a Signal
that contains the state
a number of times. Namely, repeats
times.
sourcepub fn period(self, period: u16) -> Self
pub fn period(self, period: u16) -> Self
Set the period for a signal. This is mostly important for clock signals.
sourcepub fn phase(self, phase: impl Into<CycleOffset>) -> Self
pub fn phase(self, phase: impl Into<CycleOffset>) -> Self
Set the phase for a Signal
. This is mostly important for clock signals.
sourcepub fn get_data_fields(&self) -> &[String]
pub fn get_data_fields(&self) -> &[String]
Get the data of the Signal
.
sourcepub fn get_phase(&self) -> CycleOffset
pub fn get_phase(&self) -> CycleOffset
Get the phase of the Signal
.
sourcepub fn get_period(&self) -> u16
pub fn get_period(&self) -> u16
Get the period of the Signal
.
sourcepub fn cycles(&self) -> &[CycleState]
pub fn cycles(&self) -> &[CycleState]
Get the cycles that a signal currently contains.
Trait Implementations§
source§impl From<Signal> for FigureSection
impl From<Signal> for FigureSection
source§impl From<SignalObject> for Signal
Available on crate feature serde
only.
impl From<SignalObject> for Signal
serde
only.