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.