pub struct Rule<Q = String, A = char>where
Q: RawState,{
pub head: Head<Q, A>,
pub tail: Tail<Q, A>,
}
Fields§
§head: Head<Q, A>
§tail: Tail<Q, A>
Implementations§
Source§impl<Q, A> Rule<Q, A>where
Q: RawState,
impl<Q, A> Rule<Q, A>where
Q: RawState,
pub fn new() -> RuleBuilder<Q, A>
Sourcepub const fn tail(&self) -> &Tail<Q, A>
pub const fn tail(&self) -> &Tail<Q, A>
returns an immutable reference to the Tail of the [Instruction]
Sourcepub const fn tail_mut(&mut self) -> &mut Tail<Q, A>
pub const fn tail_mut(&mut self) -> &mut Tail<Q, A>
returns a mutable reference to the Tail of the [Instruction]
Sourcepub fn head_view(&self) -> Head<&Q, &A>
pub fn head_view(&self) -> Head<&Q, &A>
returns an instance of the Head whose elements are immutable references
Sourcepub const fn tail_view(&self) -> Tail<&Q, &A>
pub const fn tail_view(&self) -> Tail<&Q, &A>
returns an instance of the Tail whose elements are immutable references
Sourcepub const fn state_mut(&mut self) -> &mut State<Q>
pub const fn state_mut(&mut self) -> &mut State<Q>
returns a mutable reference to the current State of the system
Sourcepub fn symbol_mut(&mut self) -> &mut A
pub fn symbol_mut(&mut self) -> &mut A
returns a mutable reference to the symbol of the Head
Sourcepub const fn next_state(&self) -> &State<Q>
pub const fn next_state(&self) -> &State<Q>
returns the next State of the system
Sourcepub const fn next_state_mut(&mut self) -> &mut State<Q>
pub const fn next_state_mut(&mut self) -> &mut State<Q>
returns a mutable reference to the next State of the system
Sourcepub const fn next_symbol(&self) -> &A
pub const fn next_symbol(&self) -> &A
returns the symbol which will be written by the Head
Sourcepub fn next_symbol_mut(&mut self) -> &mut A
pub fn next_symbol_mut(&mut self) -> &mut A
returns a mutable reference to the next symbol
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 Rule
Sourcepub fn set_symbol(&mut self, symbol: A) -> &mut Self
pub fn set_symbol(&mut self, symbol: A) -> &mut Self
update the current symbol and return a mutable reference to the Rule
Sourcepub fn set_next_state(&mut self, state: State<Q>) -> &mut Self
pub fn set_next_state(&mut self, state: State<Q>) -> &mut Self
Sourcepub fn set_next_symbol(&mut self, symbol: A) -> &mut Self
pub fn set_next_symbol(&mut self, symbol: A) -> &mut Self
updates the next symbol and returns a mutable reference to the Rule
Sourcepub fn into_next_head(self) -> Head<Q, A>
pub fn into_next_head(self) -> Head<Q, A>
consumes the current object and returns the next Head of the system
Sourcepub const fn write_symbol(&self) -> &A
pub const fn write_symbol(&self) -> &A
returns the value which for which the current object will be replaced with
Sourcepub fn into_tuple(self) -> (Head<Q, A>, Tail<Q, A>)
pub fn into_tuple(self) -> (Head<Q, A>, Tail<Q, A>)
Trait Implementations§
Source§impl<Q, S> BorrowMut<Head<Q, S>> for Rule<Q, S>where
Q: RawState,
impl<Q, S> BorrowMut<Head<Q, S>> for Rule<Q, S>where
Q: RawState,
Source§fn borrow_mut(&mut self) -> &mut Head<Q, S>
fn borrow_mut(&mut self) -> &mut Head<Q, S>
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<'de, Q, A> Deserialize<'de> for Rule<Q, A>
impl<'de, Q, A> Deserialize<'de> for Rule<Q, A>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<Q, S> Extend<Rule<Q, S>> for RuleMap<Q, S>
impl<Q, S> Extend<Rule<Q, S>> for RuleMap<Q, S>
Source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = Rule<Q, S>>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = Rule<Q, S>>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl<Q, S> Extend<Rule<Q, S>> for RuleSet<Q, S>where
Q: RawState,
impl<Q, S> Extend<Rule<Q, S>> for RuleSet<Q, S>where
Q: RawState,
Source§fn extend<I: IntoIterator<Item = Rule<Q, S>>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = Rule<Q, S>>>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)