#[repr(C)]pub struct Tail<Q, S> {
pub direction: Direction,
pub state: State<Q>,
pub symbol: S,
}
Expand description
The Tail is a 3-tuple containing the direction, state, and symbol that an actor is instructed to execute whenever it assumes the head configuration assigned to the tail.
Fields§
§direction: Direction
§state: State<Q>
§symbol: S
Implementations§
Source§impl<Q, S> Tail<Q, S>where
Q: RawState,
impl<Q, S> Tail<Q, S>where
Q: RawState,
pub const fn new(direction: Direction, state: State<Q>, symbol: S) -> Self
Sourcepub const fn as_tuple(&self) -> (Direction, &State<Q>, &S)
pub const fn as_tuple(&self) -> (Direction, &State<Q>, &S)
returns the direction, state, and symbol as a 3-tuple
Sourcepub fn into_tuple(self) -> (Direction, State<Q>, S)
pub fn into_tuple(self) -> (Direction, State<Q>, S)
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 the direction the head is instructed to move
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 S
pub const fn symbol_mut(&mut self) -> &mut S
returns a mutable reference to the symbol of the tail
Sourcepub fn set_direction(&mut self, direction: Direction) -> &mut Self
pub fn set_direction(&mut self, direction: Direction) -> &mut Self
updates the current direction and returns a mutable reference to the tail
Sourcepub fn set_state(&mut self, State: State<Q>) -> &mut Self
pub fn set_state(&mut self, State: State<Q>) -> &mut Self
updates the current state and returns a mutable reference to the tail
Sourcepub fn set_symbol(&mut self, symbol: S) -> &mut Self
pub fn set_symbol(&mut self, symbol: S) -> &mut Self
updates the current symbol and returns a mutable reference to the tail
Sourcepub fn with_direction(self, direction: Direction) -> Self
pub fn with_direction(self, direction: Direction) -> Self
Configures the tail with a new direction
Sourcepub fn with_state(self, State: State<Q>) -> Self
pub fn with_state(self, State: State<Q>) -> Self
Configures the tail with a new state
Sourcepub fn with_symbol(self, symbol: S) -> Self
pub fn with_symbol(self, symbol: S) -> Self
Configures the tail with a new symbol
Sourcepub const fn view(&self) -> Tail<&Q, &S>
pub const fn view(&self) -> Tail<&Q, &S>
returns an instance of the head where each element within the created instance is a mutable reference
Sourcepub fn view_mut(&mut self) -> Tail<&mut Q, &mut S>
pub fn view_mut(&mut self) -> Tail<&mut Q, &mut S>
returns a new Tail
containing mutabl references to the state and symbol
pub fn to_ref(&self) -> Tail<&Q, &S>
view
instead, as it is more idiomatic and clearer.pub fn to_mut(&mut self) -> Tail<&mut Q, &mut S>
view_mut
instead, as it is more idiomatic and clearer.