Struct Rule

Source
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,

Source

pub fn new() -> RuleBuilder<Q, A>

Source

pub const fn head(&self) -> &Head<Q, A>

returns an immutable reference to the Head

Source

pub const fn head_mut(&mut self) -> &mut Head<Q, A>

returns a mutable reference to the Head

Source

pub const fn tail(&self) -> &Tail<Q, A>

returns an immutable reference to the Tail of the [Instruction]

Source

pub const fn tail_mut(&mut self) -> &mut Tail<Q, A>

returns a mutable reference to the Tail of the [Instruction]

Source

pub fn head_view(&self) -> Head<&Q, &A>

returns an instance of the Head whose elements are immutable references

Source

pub const fn tail_view(&self) -> Tail<&Q, &A>

returns an instance of the Tail whose elements are immutable references

Source

pub const fn direction(&self) -> Direction

returns the direction of the shift

Source

pub const fn state(&self) -> &State<Q>

returns the current State of the system

Source

pub const fn state_mut(&mut self) -> &mut State<Q>

returns a mutable reference to the current State of the system

Source

pub const fn symbol(&self) -> &A

returns the symbol of the Head

Source

pub fn symbol_mut(&mut self) -> &mut A

returns a mutable reference to the symbol of the Head

Source

pub const fn next_state(&self) -> &State<Q>

returns the next State of the system

Source

pub const fn next_state_mut(&mut self) -> &mut State<Q>

returns a mutable reference to the next State of the system

Source

pub const fn next_symbol(&self) -> &A

returns the symbol which will be written by the Head

Source

pub fn next_symbol_mut(&mut self) -> &mut A

returns a mutable reference to the next symbol

Source

pub fn set_direction(&mut self, direction: Direction) -> &mut Self

updates the current [Direction] and returns a mutable reference to the Rule

Source

pub fn set_symbol(&mut self, symbol: A) -> &mut Self

update the current symbol and return a mutable reference to the Rule

Source

pub fn set_state(&mut self, state: State<Q>) -> &mut Self

updates the current State and returns a mutable reference to the Rule

Source

pub fn set_next_state(&mut self, state: State<Q>) -> &mut Self

updates the current State and returns a mutable reference to the Rule

Source

pub fn set_next_symbol(&mut self, symbol: A) -> &mut Self

updates the next symbol and returns a mutable reference to the Rule

Source

pub fn set_head(&mut self, state: State<Q>, symbol: A) -> &mut Self

updates the current State and symbol and returns a mutable reference to the Rule

Source

pub fn set_tail(&mut self, state: State<Q>, symbol: A) -> &mut Self

updates the current State and symbol and returns a mutable reference to the Rule

Source

pub fn next_head(&self) -> Head<&Q, &A>

returns the next Head of the system

Source

pub fn into_next_head(self) -> Head<Q, A>

consumes the current object and returns the next Head of the system

Source

pub const fn write_symbol(&self) -> &A

returns the value which for which the current object will be replaced with

Source

pub fn into_tuple(self) -> (Head<Q, A>, Tail<Q, A>)

consumes the current object and returns a 2-tuple consisting of the Head and Tail

Source

pub fn cloned(&self) -> Rule<Q, A>
where Q: Clone, A: Clone,

returns a new instance of the Rule with cloned elements

Source

pub fn copied(&self) -> Rule<Q, A>
where Q: Clone, A: Clone,

returns a new instance of the Rule with copied elements

Trait Implementations§

Source§

impl<Q, S> AsMut<Head<Q, S>> for Rule<Q, S>
where Q: RawState,

Source§

fn as_mut(&mut self) -> &mut Head<Q, S>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<Q, S> AsMut<Tail<Q, S>> for Rule<Q, S>
where Q: RawState,

Source§

fn as_mut(&mut self) -> &mut Tail<Q, S>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<Q, S> AsRef<Head<Q, S>> for Rule<Q, S>
where Q: RawState,

Source§

fn as_ref(&self) -> &Head<Q, S>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<Q, S> AsRef<Tail<Q, S>> for Rule<Q, S>
where Q: RawState,

Source§

fn as_ref(&self) -> &Tail<Q, S>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<Q, S> Borrow<Head<Q, S>> for Rule<Q, S>
where Q: RawState,

Source§

fn borrow(&self) -> &Head<Q, S>

Immutably borrows from an owned value. Read more
Source§

impl<Q, S> Borrow<Tail<Q, S>> for Rule<Q, S>
where Q: RawState,

Source§

fn borrow(&self) -> &Tail<Q, S>

Immutably borrows from an owned value. Read more
Source§

impl<Q, S> BorrowMut<Head<Q, S>> for Rule<Q, S>
where Q: RawState,

Source§

fn borrow_mut(&mut self) -> &mut Head<Q, S>

Mutably borrows from an owned value. Read more
Source§

impl<Q, S> BorrowMut<Tail<Q, S>> for Rule<Q, S>
where Q: RawState,

Source§

fn borrow_mut(&mut self) -> &mut Tail<Q, S>

Mutably borrows from an owned value. Read more
Source§

impl<Q, A: Clone> Clone for Rule<Q, A>
where Q: RawState + Clone,

Source§

fn clone(&self) -> Rule<Q, A>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Q, A: Debug> Debug for Rule<Q, A>
where Q: RawState + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Q, A: Default> Default for Rule<Q, A>
where Q: RawState + Default,

Source§

fn default() -> Rule<Q, A>

Returns the “default value” for a type. Read more
Source§

impl<'de, Q, A> Deserialize<'de> for Rule<Q, A>
where Q: RawState + Deserialize<'de>, A: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<Q, S> Directive<Q, S> for Rule<Q, S>
where Q: RawState,

Source§

impl<Q, S> Extend<Rule<Q, S>> for RuleMap<Q, S>
where Q: RawState + Eq + Hash, S: Eq + Hash,

Source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = Rule<Q, S>>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

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)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<Q, S> From<(Head<Q, S>, Tail<Q, S>)> for Rule<Q, S>
where Q: RawState,

Source§

fn from((head, tail): (Head<Q, S>, Tail<Q, S>)) -> Self

Converts to this type from the input type.
Source§

impl<Q, S> From<Rule<Q, S>> for (Head<Q, S>, Tail<Q, S>)
where Q: RawState,

Source§

fn from(rule: Rule<Q, S>) -> Self

Converts to this type from the input type.
Source§

impl<Q, S> From<RuleBuilder<Q, S>> for Rule<Q, S>
where Q: RawState,

Source§

fn from(builder: RuleBuilder<Q, S>) -> Self

Converts to this type from the input type.
Source§

impl<Q, S> FromIterator<Rule<Q, S>> for RuleMap<Q, S>
where Q: RawState + Default + Eq + Hash, S: Eq + Hash,

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = Rule<Q, S>>,

Creates a value from an iterator. Read more
Source§

impl<Q, S> FromIterator<Rule<Q, S>> for RuleSet<Q, S>
where Q: RawState + Default,

Source§

fn from_iter<I: IntoIterator<Item = Rule<Q, S>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<Q, A: Hash> Hash for Rule<Q, A>
where Q: RawState + Hash,

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<Q, A: Ord> Ord for Rule<Q, A>
where Q: RawState + Ord,

Source§

fn cmp(&self, other: &Rule<Q, A>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<Q, S> PartialEq<(Head<Q, S>, Tail<Q, S>)> for Rule<Q, S>
where Q: RawState + PartialEq, S: PartialEq,

Source§

fn eq(&self, other: &(Head<Q, S>, Tail<Q, S>)) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Q, S> PartialEq<Head<Q, S>> for Rule<Q, S>
where Q: RawState + PartialEq, S: PartialEq,

Source§

fn eq(&self, other: &Head<Q, S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Q, S> PartialEq<Tail<Q, S>> for Rule<Q, S>
where Q: RawState + PartialEq, S: PartialEq,

Source§

fn eq(&self, other: &Tail<Q, S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Q, A: PartialEq> PartialEq for Rule<Q, A>
where Q: RawState + PartialEq,

Source§

fn eq(&self, other: &Rule<Q, A>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Q, A: PartialOrd> PartialOrd for Rule<Q, A>
where Q: RawState + PartialOrd,

Source§

fn partial_cmp(&self, other: &Rule<Q, A>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<Q, S> Scope<Q, S> for Rule<Q, S>
where Q: RawState,

Source§

impl<Q, A> Serialize for Rule<Q, A>
where Q: RawState + Serialize, A: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<Q, A: Copy> Copy for Rule<Q, A>
where Q: RawState + Copy,

Source§

impl<Q, A: Eq> Eq for Rule<Q, A>
where Q: RawState + Eq,

Source§

impl<Q, A> StructuralPartialEq for Rule<Q, A>
where Q: RawState,

Auto Trait Implementations§

§

impl<Q, A> Freeze for Rule<Q, A>
where A: Freeze, Q: Freeze,

§

impl<Q, A> RefUnwindSafe for Rule<Q, A>

§

impl<Q, A> Send for Rule<Q, A>
where A: Send,

§

impl<Q, A> Sync for Rule<Q, A>
where A: Sync,

§

impl<Q, A> Unpin for Rule<Q, A>
where A: Unpin, Q: Unpin,

§

impl<Q, A> UnwindSafe for Rule<Q, A>
where A: UnwindSafe, Q: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<K, S> Identity<K> for S
where S: Borrow<K>, K: Identifier,

Source§

type Item = S

Source§

fn get(&self) -> &<S as Identity<K>>::Item

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<A, Q, S> Transition<Q, S> for A
where A: Scope<Q, S> + Directive<Q, S>, Q: RawState, S: Symbolic,

Source§

fn direction(&self) -> Direction

Source§

fn current_state(&self) -> &State<Q>

Source§

fn next_state(&self) -> &State<Q>

Source§

fn symbol(&self) -> &S

Source§

fn write_symbol(&self) -> &S

Source§

fn head(&self) -> Head<&Q, &S>

Source§

fn tail(&self) -> Tail<&Q, &S>

Source§

fn as_rule(&self) -> Rule<&Q, &S>

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,