Tokens

Trait Tokens 

Source
pub trait Tokens:
    AsRef<Self::Value>
    + Clone
    + Debug
    + Default
    + Display
    + PartialEq
    + Eq
    + PartialOrd
    + Ord
    + Hash {
    type Value: Default + Display + PartialEq + Eq + PartialOrd + Ord + Hash;

    // Required methods
    fn value(&self) -> &Self::Value;
    fn set_value(&mut self, value: Self::Value);

    // Provided methods
    fn empty(&mut self) { ... }
    fn is_empty(&self) -> bool { ... }
}
Expand description

Note that this trait requires an implementation of Display which by convention will return an empty string if is_empty is true. To return a representation of the empty value use alternate marker in the format, "{#}" instead of "{}".

For example, an elementary net allows only boolean tokens and will write "●" for a present token and "○" for the alternate representation for an empty token.

Required Associated Types§

Required Methods§

Source

fn value(&self) -> &Self::Value

Source

fn set_value(&mut self, value: Self::Value)

Provided Methods§

Source

fn empty(&mut self)

Source

fn is_empty(&self) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§