Trait rex::State

source ·
pub trait State: Debug + Send + PartialEq + Copy {
    // Required method
    fn get_kind(&self) -> &dyn Kind<State = Self>;

    // Provided methods
    fn fail(&mut self)
       where Self: Sized { ... }
    fn complete(&mut self)
       where Self: Sized { ... }
    fn is_completed(&self) -> bool
       where Self: Sized,
             for<'a> &'a Self: PartialEq<&'a Self> { ... }
    fn is_failed(&self) -> bool
       where Self: Sized,
             for<'a> &'a Self: PartialEq<&'a Self> { ... }
    fn is_new(&self) -> bool
       where Self: Sized,
             for<'a> &'a Self: PartialEq<&'a Self> { ... }
    fn is_terminal(&self) -> bool
       where Self: Sized { ... }
    fn kind_eq(&self, kind: &dyn Kind<State = Self>) -> bool
       where Self: Sized { ... }
}
Expand description

A trait for types representing state machine lifecycles. These types should be field-less enumerations or enumerations whose variants only contain field-less enumerations; note that Copy is a required supertrait.

Required Methods§

source

fn get_kind(&self) -> &dyn Kind<State = Self>

Provided Methods§

source

fn fail(&mut self)
where Self: Sized,

source

fn complete(&mut self)
where Self: Sized,

source

fn is_completed(&self) -> bool
where Self: Sized, for<'a> &'a Self: PartialEq<&'a Self>,

source

fn is_failed(&self) -> bool
where Self: Sized, for<'a> &'a Self: PartialEq<&'a Self>,

source

fn is_new(&self) -> bool
where Self: Sized, for<'a> &'a Self: PartialEq<&'a Self>,

source

fn is_terminal(&self) -> bool
where Self: Sized,

represents a state that will no longer change

source

fn kind_eq(&self, kind: &dyn Kind<State = Self>) -> bool
where Self: Sized,

&dyn Kind<State = Self> cannot do direct partial comparison due to type opacity so State::new_state(self) is called to allow a vtable lookup

Object Safety§

This trait is not object safe.

Implementors§