Struct wavedrom::Signal

source ·
pub struct Signal { /* private fields */ }
Expand description

A diagram signal line with a set of cycles.

Implementations§

source§

impl Signal

source

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.

source

pub fn new() -> Self

Create a new empty signal

source

pub fn with_cycle_str(states: impl AsRef<str>) -> Self

Create a new Signal with the cycles formed from the states string.

source

pub fn add_cycles(self, cycles: impl IntoIterator<Item = CycleState>) -> Self

Add a set of CycleStates to the Signal.

source

pub fn add_cycle(self, cycle: CycleState) -> Self

Add a CycleState to the Signal.

source

pub fn add_n_cycles(self, n: usize, cycle: CycleState) -> Self

Add a CycleState to repeat n times to the Signal.

source

pub fn add_nodes(self, nodes: impl AsRef<str>) -> Self

Add a set of nodes to the Signal.

This is used for putting markers and arrows / edges on the diagram. For more information look at the edges documentation.

source

pub fn add_node(self, node: Option<char>) -> Self

Add a node to the Signal.

This is used for putting markers and arrows / edges on the diagram. For more information look at the edges documentation.

source

pub fn add_data_fields( self, fields: impl IntoIterator<Item = impl Into<String>> ) -> Self

Add a set of nodes to the Signal.

This is used for putting markers and arrows / edges on the diagram. For more information look at the edges documentation.

source

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.

source

pub fn repeated(state: CycleState, repeats: usize) -> Self

Create a Signal that contains the state a number of times. Namely, repeats times.

source

pub fn period(self, period: u16) -> Self

Set the period for a signal. This is mostly important for clock signals.

source

pub fn phase(self, phase: impl Into<CycleOffset>) -> Self

Set the phase for a Signal. This is mostly important for clock signals.

source

pub fn name(self, name: impl Into<String>) -> Self

Set the name for a Signal

source

pub fn get_name(&self) -> &str

Get the name of the Signal.

source

pub fn get_nodes(&self) -> &str

Get the nodes of the Signal.

source

pub fn get_data_fields(&self) -> &[String]

Get the data of the Signal.

source

pub fn get_phase(&self) -> CycleOffset

Get the phase of the Signal.

source

pub fn get_period(&self) -> u16

Get the period of the Signal.

source

pub fn cycles(&self) -> &[CycleState]

Get the cycles that a signal currently contains.

Trait Implementations§

source§

impl Clone for Signal

source§

fn clone(&self) -> Signal

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Signal

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Signal

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl From<Signal> for FigureSection

source§

fn from(wave: Signal) -> Self

Converts to this type from the input type.
source§

impl From<SignalObject> for Signal

Available on crate feature serde only.
source§

fn from(item: SignalObject) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.