[][src]Struct rustfst::Tr

pub struct Tr<W> {
    pub ilabel: Label,
    pub olabel: Label,
    pub weight: W,
    pub nextstate: StateId,
}

Structure representing a transition from a state to another state in a FST.

Fields

ilabel: Label

Input label.

olabel: Label

Output label.

weight: W

Weight.

nextstate: StateId

ID of the next state.

Implementations

impl<W> Tr<W>[src]

pub fn new<S: Into<W>>(
    ilabel: Label,
    olabel: Label,
    weight: S,
    nextstate: StateId
) -> Self
[src]

Creates a new Tr.

Example

let transition = Tr::<TropicalWeight>::new(0, 1, 1.3, 2);

assert_eq!(transition.ilabel, 0);
assert_eq!(transition.olabel, 1);
assert_eq!(transition.weight, TropicalWeight::new(1.3));
assert_eq!(transition.nextstate, 2);

pub fn set_value(&mut self, tr: &Tr<W>) where
    W: Clone
[src]

Updates the values of the attributes of the Tr from another Tr.

Example

let mut tr_1 = Tr::<TropicalWeight>::new(0, 1, 1.3, 2);
let tr_2 = Tr::new(1, 2, 1.2, 3);

tr_1.set_value(&tr_2);

assert_eq!(tr_1, tr_2);

impl<W: SerializableSemiring> Tr<W>[src]

pub fn tr_type() -> String[src]

Trait Implementations

impl<W: Clone> Clone for Tr<W>[src]

impl<W: Debug> Debug for Tr<W>[src]

impl<W: Eq> Eq for Tr<W>[src]

impl<W: Hash> Hash for Tr<W>[src]

impl<W: PartialEq> PartialEq<Tr<W>> for Tr<W>[src]

impl<W: PartialOrd> PartialOrd<Tr<W>> for Tr<W>[src]

impl<W> StructuralEq for Tr<W>[src]

impl<W> StructuralPartialEq for Tr<W>[src]

Auto Trait Implementations

impl<W> RefUnwindSafe for Tr<W> where
    W: RefUnwindSafe

impl<W> Send for Tr<W> where
    W: Send

impl<W> Sync for Tr<W> where
    W: Sync

impl<W> Unpin for Tr<W> where
    W: Unpin

impl<W> UnwindSafe for Tr<W> where
    W: UnwindSafe

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<T> From<T> for T[src]

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

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

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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.