#[repr(C)]pub struct Tail<Q, A> {
pub direction: Direction,
pub next_state: State<Q>,
pub write_symbol: A,
}Expand description
The Tail of a rule defines the reaction of the actor under specific conditions.
Specifically, it defines the next state, the symbol to write, and the direction to move
Fields§
§direction: Directiondefines the direction to move after writing the symbol
next_state: State<Q>§write_symbol: AImplementations§
Source§impl<Q, A> Tail<Q, A>where
Q: RawState,
impl<Q, A> Tail<Q, A>where
Q: RawState,
Sourcepub const fn new(direction: Direction, next_state: Q, write_symbol: A) -> Self
pub const fn new(direction: Direction, next_state: Q, write_symbol: A) -> Self
initializes a new Tail with the given direction, state, and symbol
Sourcepub const fn stay(state: Q, symbol: A) -> Self
pub const fn stay(state: Q, symbol: A) -> Self
initializes a new Tail at rest using the given state and symbol
Sourcepub const fn left(state: Q, symbol: A) -> Self
pub const fn left(state: Q, symbol: A) -> Self
initializes a new Tail moving to the left using the given state and symbol
Sourcepub const fn right(state: Q, symbol: A) -> Self
pub const fn right(state: Q, symbol: A) -> Self
initializes a new Tail moving to the right using the given state and symbol
Sourcepub fn from_head(head: Head<Q, A>) -> Self
pub fn from_head(head: Head<Q, A>) -> Self
returns a new instance of the Tail using the given direction and head
pub fn from_head_with_direction(head: Head<Q, A>, direction: Direction) -> Self
Sourcepub const fn as_tuple(&self) -> (Direction, &State<Q>, &A)
pub const fn as_tuple(&self) -> (Direction, &State<Q>, &A)
returns the direction, state, and symbol as a 3-tuple
Sourcepub fn into_tuple(self) -> (Direction, State<Q>, A)
pub fn into_tuple(self) -> (Direction, State<Q>, A)
consumes the tail and returns the direction, state, and symbol as a 3-tuple
Sourcepub const fn direction(&self) -> Direction
pub const fn direction(&self) -> Direction
returns a copy of the direction the head should shift after writing the symbol and updating the state.
Sourcepub const fn state(&self) -> &State<Q>
pub const fn state(&self) -> &State<Q>
returns the next state with an immutable reference to the inner value
Sourcepub const fn state_mut(&mut self) -> &mut State<Q>
pub const fn state_mut(&mut self) -> &mut State<Q>
returns the next state with a mutable reference to the inner value
Sourcepub const fn symbol_mut(&mut self) -> &mut A
pub const fn symbol_mut(&mut self) -> &mut A
returns a mutable reference to the symbol of the tail
Sourcepub const fn set_direction(&mut self, direction: Direction)
pub const fn set_direction(&mut self, direction: Direction)
update the direction of the tail
Sourcepub fn set_symbol(&mut self, symbol: A)
pub fn set_symbol(&mut self, symbol: A)
update the defined symbol for the tail
Sourcepub fn with_direction(self, direction: Direction) -> Self
pub fn with_direction(self, direction: Direction) -> Self
consumes the current instance to create another with the given Direction
Sourcepub fn with_state(self, state: Q) -> Self
pub fn with_state(self, state: Q) -> Self
consumes the current instance to create another with the given state
Sourcepub fn with_symbol(self, symbol: A) -> Self
pub fn with_symbol(self, symbol: A) -> Self
Configures the tail with a new symbol
Sourcepub const fn get_head(&self) -> Head<&Q, &A>
pub const fn get_head(&self) -> Head<&Q, &A>
returns an instance of the Head containing references to the next state and symbol.
Sourcepub fn get_head_mut(&mut self) -> Head<&mut Q, &mut A>
pub fn get_head_mut(&mut self) -> Head<&mut Q, &mut A>
returns a new Head initialized with mutable references to the state and symbol
Sourcepub fn into_head(self) -> Head<Q, A>
pub fn into_head(self) -> Head<Q, A>
consumes the current instance of the tail to convert it into a Head containing the
next state and symbol to write.
Sourcepub fn into_head_tuple(self) -> (Direction, Head<Q, A>)
pub fn into_head_tuple(self) -> (Direction, Head<Q, A>)
Trait Implementations§
Source§impl<Q, A> BorrowMut<State<Q>> for Tail<Q, A>where
Q: RawState,
impl<Q, A> BorrowMut<State<Q>> for Tail<Q, A>where
Q: RawState,
Source§fn borrow_mut(&mut self) -> &mut State<Q>
fn borrow_mut(&mut self) -> &mut State<Q>
Source§impl<Q, S> BorrowMut<Tail<Q, S>> for Rule<Q, S>where
Q: RawState,
impl<Q, S> BorrowMut<Tail<Q, S>> for Rule<Q, S>where
Q: RawState,
Source§fn borrow_mut(&mut self) -> &mut Tail<Q, S>
fn borrow_mut(&mut self) -> &mut Tail<Q, S>
Source§impl<Q: Ord, A: Ord> Ord for Tail<Q, A>
impl<Q: Ord, A: Ord> Ord for Tail<Q, A>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<Q, A> PartialEq<(Direction, Head<Q, A>)> for Tail<Q, A>
impl<Q, A> PartialEq<(Direction, Head<Q, A>)> for Tail<Q, A>
Source§impl<Q, A> PartialEq<(Direction, State<Q>, A)> for Tail<Q, A>
impl<Q, A> PartialEq<(Direction, State<Q>, A)> for Tail<Q, A>
Source§impl<Q, A> PartialEq<(State<Q>, A)> for Tail<Q, A>
impl<Q, A> PartialEq<(State<Q>, A)> for Tail<Q, A>
Source§impl<Q: PartialOrd, A: PartialOrd> PartialOrd for Tail<Q, A>
impl<Q: PartialOrd, A: PartialOrd> PartialOrd for Tail<Q, A>
Source§impl<Q, A> RawTailMut for Tail<Q, A>where
Q: RawState,
impl<Q, A> RawTailMut for Tail<Q, A>where
Q: RawState,
Source§fn direction_mut(&mut self) -> &mut Direction
fn direction_mut(&mut self) -> &mut Direction
returns a mutable reference to the direction of the tail.
Source§fn next_state_mut(&mut self) -> &mut State<Q>
fn next_state_mut(&mut self) -> &mut State<Q>
returns a mutable reference to the next state.
Source§fn write_symbol_mut(&mut self) -> &mut A
fn write_symbol_mut(&mut self) -> &mut A
returns a mutable reference to the symbol to write.
Source§impl<Q, A> TailRepr for Tail<Q, A>where
Q: RawState,
impl<Q, A> TailRepr for Tail<Q, A>where
Q: RawState,
Source§fn new(direction: Direction, next_state: Q, write_symbol: A) -> Self
fn new(direction: Direction, next_state: Q, write_symbol: A) -> Self
creates a new tail from the given direction, next state, and symbol to write