Symbol

Enum Symbol 

Source
pub enum Symbol<B, U, A>
where B: Symbolic, U: Symbolic, A: Symbolic,
{ Binary(B), Unary(U), Atom(A), Left, Right, }

Variants§

§

Binary(B)

§

Unary(U)

§

Atom(A)

§

Left

§

Right

Implementations§

Source§

impl<B, U, A> Symbol<B, U, A>
where B: Symbolic, U: Symbolic, A: Symbolic,

A generic type for when we need to compare over B, U, and A, the types that go into our formulae. Since they implement Ord individually this wrapper type allows comparison between any of the three types assuming the convention that U(nary) operators always have higher precedence than B(inary) operators.

Source

pub fn from_tree(t: &Tree<B, U, A>) -> Self

Source

pub fn from_zipper(z: &Zipper<B, U, A>) -> Option<Self>

Turn the ‘value’ of a zipper into a symbol, or none for a top zipper.

Trait Implementations§

Source§

impl<B, U, A> Clone for Symbol<B, U, A>
where B: Symbolic + Clone, U: Symbolic + Clone, A: Symbolic + Clone,

Source§

fn clone(&self) -> Symbol<B, U, 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<B, U, A> Debug for Symbol<B, U, A>
where B: Symbolic + Debug, U: Symbolic + Debug, A: Symbolic + Debug,

Source§

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

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

impl<B, U, A> Display for Symbol<B, U, A>
where B: Symbolic, U: Symbolic, A: Symbolic,

Source§

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

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

impl<B, U, A> Hash for Symbol<B, U, A>
where B: Symbolic + Hash, U: Symbolic + Hash, A: Symbolic + 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<B, U, A> Match for Symbol<B, U, A>
where B: Symbolic + Match, U: Symbolic + Match, A: Symbolic + Match,

Source§

fn match_str(s: &str) -> Option<Self>

Given a string, return Self if the string matches some element of Self.
Source§

fn get_matches(&self) -> Vec<String>

Given an element of Self, return the corresponding strings as a vector.
Source§

fn match_prefix(s: &str) -> Option<(usize, Self)>

Match a prefix of a given string against the string matches. Uses the conventional max-munch principle: if the string is "orange" and "o" and "or" are both matches, the method will return "or".
Source§

impl<B, U, A> Ord for Symbol<B, U, A>
where B: Symbolic + Ord, U: Symbolic + Ord, A: Symbolic + Ord,

Source§

fn cmp(&self, other: &Symbol<B, U, 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<B, U, A> PartialEq for Symbol<B, U, A>

Source§

fn eq(&self, other: &Symbol<B, U, 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<B, U, A> PartialOrd for Symbol<B, U, A>

Source§

fn partial_cmp(&self, other: &Symbol<B, U, 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<B, U, A> Copy for Symbol<B, U, A>
where B: Symbolic + Copy, U: Symbolic + Copy, A: Symbolic + Copy,

Source§

impl<B, U, A> Eq for Symbol<B, U, A>
where B: Symbolic + Eq, U: Symbolic + Eq, A: Symbolic + Eq,

Source§

impl<B, U, A> StructuralPartialEq for Symbol<B, U, A>
where B: Symbolic, U: Symbolic, A: Symbolic,

Auto Trait Implementations§

§

impl<B, U, A> Freeze for Symbol<B, U, A>
where B: Freeze, U: Freeze, A: Freeze,

§

impl<B, U, A> RefUnwindSafe for Symbol<B, U, A>

§

impl<B, U, A> Send for Symbol<B, U, A>
where B: Send, U: Send, A: Send,

§

impl<B, U, A> Sync for Symbol<B, U, A>
where B: Sync, U: Sync, A: Sync,

§

impl<B, U, A> Unpin for Symbol<B, U, A>
where B: Unpin, U: Unpin, A: Unpin,

§

impl<B, U, A> UnwindSafe for Symbol<B, U, A>
where B: UnwindSafe, U: UnwindSafe, A: 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<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<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.