[][src]Struct tydi::physical::Complexity

pub struct Complexity { /* fields omitted */ }

Interface complexity level.

This logical stream parameter specifies the guarantees a source makes about how elements are transferred. Equivalently, it specifies the assumptions a sink can safely make.

Examples

use tydi::physical::Complexity;

let c3 = Complexity::new_major(3);
let c30 = Complexity::new(vec![3, 0])?;
let c31 = Complexity::new(vec![3, 1])?;
let c4 = Complexity::new_major(4);

assert_eq!(c3, c30);
assert!(c3 < c31);
assert!(c31 < c4);

assert_eq!(c31.to_string(), "3.1");

Reference

Methods

impl Complexity[src]

pub fn new(level: impl IntoIterator<Item = NonNegative>) -> Result<Self>[src]

Constructs a new Complexity with provided level. Returns an error when the provided level iterator is empty.

Examples

use tydi::physical::Complexity;

let c = Complexity::new(vec![1, 2, 3, 4])?;
assert!(Complexity::new(vec![]).is_err());

pub fn new_major(level: NonNegative) -> Self[src]

Constructs a new Complexity with provided level as major version.

Examples

use tydi::physical::Complexity;

let c = Complexity::new_major(4);

assert_eq!(c, Complexity::new(vec![4])?);

pub fn level(&self) -> &[NonNegative][src]

Returns the level of this Complexity.

Examples

use tydi::physical::Complexity;

let c = Complexity::new(vec![3, 14])?;
assert_eq!(c.level(), &[3, 14]);

pub fn major(&self) -> NonNegative[src]

Returns the major version of this Complexity level.

Examples

use tydi::physical::Complexity;

let c = Complexity::new(vec![3, 14])?;
assert_eq!(c.major(), 3);

Trait Implementations

impl Clone for Complexity[src]

impl Debug for Complexity[src]

impl Default for Complexity[src]

impl Display for Complexity[src]

fn fmt(&self, f: &mut Formatter) -> Result[src]

Display a complexity level as a version number. The levels are separated by periods.

Examples

use tydi::physical::Complexity;

let c = Complexity::new(vec![3, 14])?;
assert_eq!(c.to_string(), "3.14");

impl Eq for Complexity[src]

impl From<u32> for Complexity[src]

fn from(major: NonNegative) -> Self[src]

Convert a NonNegative into complexity with the NonNegative as major version.

impl FromStr for Complexity[src]

type Err = Error

The associated error which can be returned from parsing.

impl Ord for Complexity[src]

fn cmp(&self, other: &Complexity) -> Ordering[src]

A complexity number is higher than another when the leftmost integer is greater, and lower when the leftmost integer is lower. If the leftmost integer is equal, the next integer is checked recursively. If one complexity number has more entries than another, the shorter number is padded with zeros on the right.

impl PartialEq<Complexity> for Complexity[src]

fn eq(&self, other: &Self) -> bool[src]

A complexity number is higher than another when the leftmost integer is greater, and lower when the leftmost integer is lower. If the leftmost integer is equal, the next integer is checked recursively. If one complexity number has more entries than another, the shorter number is padded with zeros on the right.

impl PartialOrd<Complexity> for Complexity[src]

impl TryFrom<Vec<u32>> for Complexity[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(level: Vec<NonNegative>) -> Result<Self>[src]

Try to convert a vector of NonNegative into a complexity. Returns an error when the provided vector is empty.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.