Enum calcu_rs::atom::Atom

source ·
pub enum Atom {
    Undef,
    Rational(Rational),
    Irrational(Irrational),
    Var(Var),
    Sum(Sum),
    Prod(Prod),
    Pow(Pow),
    Func(Func),
}

Variants§

§

Undef

§

Rational(Rational)

§

Irrational(Irrational)

§

Var(Var)

§

Sum(Sum)

§

Prod(Prod)

§

Pow(Pow)

§

Func(Func)

Implementations§

source§

impl Atom

source

pub const fn is_undef(&self) -> bool

Returns true if this value is of type Undef. Returns false otherwise

source

pub const fn is_rational(&self) -> bool

Returns true if this value is of type Rational. Returns false otherwise

source

pub const fn is_irrational(&self) -> bool

Returns true if this value is of type Irrational. Returns false otherwise

source

pub const fn is_var(&self) -> bool

Returns true if this value is of type Var. Returns false otherwise

source

pub const fn is_sum(&self) -> bool

Returns true if this value is of type Sum. Returns false otherwise

source

pub const fn is_prod(&self) -> bool

Returns true if this value is of type Prod. Returns false otherwise

source

pub const fn is_pow(&self) -> bool

Returns true if this value is of type Pow. Returns false otherwise

source

pub const fn is_func(&self) -> bool

Returns true if this value is of type Func. Returns false otherwise

source§

impl Atom

source

pub fn unwrap_undef(self)

Unwraps this value to the Atom::Undef variant. Panics if this value is of any other type.

source

pub fn unwrap_undef_ref(&self)

Unwraps this reference to the Atom::Undef variant. Panics if this value is of any other type.

source

pub fn unwrap_rational(self) -> Rational

Unwraps this value to the Atom::Rational variant. Panics if this value is of any other type.

source

pub fn unwrap_rational_ref(&self) -> &Rational

Unwraps this reference to the Atom::Rational variant. Panics if this value is of any other type.

source

pub fn unwrap_irrational(self) -> Irrational

Unwraps this value to the Atom::Irrational variant. Panics if this value is of any other type.

source

pub fn unwrap_irrational_ref(&self) -> &Irrational

Unwraps this reference to the Atom::Irrational variant. Panics if this value is of any other type.

source

pub fn unwrap_var(self) -> Var

Unwraps this value to the Atom::Var variant. Panics if this value is of any other type.

source

pub fn unwrap_var_ref(&self) -> &Var

Unwraps this reference to the Atom::Var variant. Panics if this value is of any other type.

source

pub fn unwrap_sum(self) -> Sum

Unwraps this value to the Atom::Sum variant. Panics if this value is of any other type.

source

pub fn unwrap_sum_ref(&self) -> &Sum

Unwraps this reference to the Atom::Sum variant. Panics if this value is of any other type.

source

pub fn unwrap_prod(self) -> Prod

Unwraps this value to the Atom::Prod variant. Panics if this value is of any other type.

source

pub fn unwrap_prod_ref(&self) -> &Prod

Unwraps this reference to the Atom::Prod variant. Panics if this value is of any other type.

source

pub fn unwrap_pow(self) -> Pow

Unwraps this value to the Atom::Pow variant. Panics if this value is of any other type.

source

pub fn unwrap_pow_ref(&self) -> &Pow

Unwraps this reference to the Atom::Pow variant. Panics if this value is of any other type.

source

pub fn unwrap_func(self) -> Func

Unwraps this value to the Atom::Func variant. Panics if this value is of any other type.

source

pub fn unwrap_func_ref(&self) -> &Func

Unwraps this reference to the Atom::Func variant. Panics if this value is of any other type.

source§

impl Atom

source

pub fn try_unwrap_undef(self) -> Result<(), TryUnwrapError<Self>>

Attempts to unwrap this value to the Atom::Undef variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source

pub fn try_unwrap_undef_ref(&self) -> Result<(), TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Atom::Undef variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source

pub fn try_unwrap_rational(self) -> Result<Rational, TryUnwrapError<Self>>

Attempts to unwrap this value to the Atom::Rational variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source

pub fn try_unwrap_rational_ref( &self, ) -> Result<&Rational, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Atom::Rational variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source

pub fn try_unwrap_irrational(self) -> Result<Irrational, TryUnwrapError<Self>>

Attempts to unwrap this value to the Atom::Irrational variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source

pub fn try_unwrap_irrational_ref( &self, ) -> Result<&Irrational, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Atom::Irrational variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source

pub fn try_unwrap_var(self) -> Result<Var, TryUnwrapError<Self>>

Attempts to unwrap this value to the Atom::Var variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source

pub fn try_unwrap_var_ref(&self) -> Result<&Var, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Atom::Var variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source

pub fn try_unwrap_sum(self) -> Result<Sum, TryUnwrapError<Self>>

Attempts to unwrap this value to the Atom::Sum variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source

pub fn try_unwrap_sum_ref(&self) -> Result<&Sum, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Atom::Sum variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source

pub fn try_unwrap_prod(self) -> Result<Prod, TryUnwrapError<Self>>

Attempts to unwrap this value to the Atom::Prod variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source

pub fn try_unwrap_prod_ref(&self) -> Result<&Prod, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Atom::Prod variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source

pub fn try_unwrap_pow(self) -> Result<Pow, TryUnwrapError<Self>>

Attempts to unwrap this value to the Atom::Pow variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source

pub fn try_unwrap_pow_ref(&self) -> Result<&Pow, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Atom::Pow variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source

pub fn try_unwrap_func(self) -> Result<Func, TryUnwrapError<Self>>

Attempts to unwrap this value to the Atom::Func variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source

pub fn try_unwrap_func_ref(&self) -> Result<&Func, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Atom::Func variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

source§

impl Atom

source

pub const UNDEF: Atom = Atom::Undef

source

pub const MINUS_TWO: Atom = _

source

pub const MINUS_ONE: Atom = _

source

pub const ZERO: Atom = _

source

pub const ONE: Atom = _

source

pub const TWO: Atom = _

source

pub const PI: Atom = _

source

pub const E: Atom = _

source

pub fn is_zero(&self) -> bool

source

pub fn is_one(&self) -> bool

source

pub fn is_min_one(&self) -> bool

source

pub fn is_pi(&self) -> bool

source

pub fn is_e(&self) -> bool

source

pub fn is_neg(&self) -> bool

source

pub fn is_pos(&self) -> bool

source

pub fn is_int(&self) -> bool

source

pub fn is_even(&self) -> bool

source

pub fn is_odd(&self) -> bool

source

pub fn is_number(&self) -> bool

source

pub fn is_real(&self) -> bool

source

pub fn is_irreducible(&self) -> bool

source

pub fn is_rational_and(&self, cond: impl Fn(&Rational) -> bool) -> bool

source

pub fn is_const(&self) -> bool

source

pub fn is_sin(&self) -> bool

source

pub fn is_cos(&self) -> bool

source

pub fn try_unwrap_int(&self) -> Option<i128>

source

pub fn unwrap_int(&self) -> i128

source

pub fn try_as_real(&self) -> Option<Real>

source

pub fn for_each_arg<'a>(&'a self, func: impl FnMut(&'a Expr))

source

pub fn fmt_ast(&self) -> FmtAtom

Trait Implementations§

source§

impl Clone for Atom

source§

fn clone(&self) -> Atom

Returns a copy 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 Debug for Atom

source§

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

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

impl<'de> Deserialize<'de> for Atom

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 Display for Atom

source§

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

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

impl From<&Atom> for FmtAtom

source§

fn from(value: &Atom) -> Self

Converts to this type from the input type.
source§

impl From<Func> for Atom

source§

fn from(value: Func) -> Self

Converts to this type from the input type.
source§

impl From<Irrational> for Atom

source§

fn from(value: Irrational) -> Self

Converts to this type from the input type.
source§

impl From<Pow> for Atom

source§

fn from(value: Pow) -> Self

Converts to this type from the input type.
source§

impl From<Prod> for Atom

source§

fn from(value: Prod) -> Self

Converts to this type from the input type.
source§

impl From<Rational> for Atom

source§

fn from(value: Rational) -> Self

Converts to this type from the input type.
source§

impl From<Real> for Atom

source§

fn from(value: Real) -> Self

Converts to this type from the input type.
source§

impl From<Sum> for Atom

source§

fn from(value: Sum) -> Self

Converts to this type from the input type.
source§

impl<__FromT0> From<__FromT0> for Atom
where Var: From<__FromT0>,

source§

fn from(value: __FromT0) -> Self

Converts to this type from the input type.
source§

impl From<i128> for Atom

source§

fn from(value: i128) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Atom

source§

fn from(value: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for Atom

source§

fn from(value: i64) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Atom

source§

fn from(value: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Atom

source§

fn from(value: u64) -> Self

Converts to this type from the input type.
source§

impl Hash for Atom

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 Ord for Atom

source§

fn cmp(&self, other: &Self) -> 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 + PartialOrd,

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

impl PartialEq<Atom> for Real

source§

fn eq(&self, other: &Atom) -> 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 PartialEq<Real> for Atom

source§

fn eq(&self, other: &Real) -> 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 PartialEq for Atom

source§

fn eq(&self, other: &Atom) -> 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 PartialOrd for Atom

source§

fn partial_cmp(&self, other: &Self) -> 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 Serialize for Atom

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 SymbolicExpr for Atom

source§

fn args(&self) -> &[Expr]

source§

fn args_mut(&mut self) -> &mut [Expr]

source§

fn reduce(&self) -> Expr

basic simplification that can be applied regardless of context Read more
source§

fn is_atom(&self) -> bool

source§

fn n_args(&self) -> usize

source§

fn iter_args(&self) -> impl Iterator<Item = &Expr>

source§

fn map_args(self, map_fn: impl Fn(&mut Expr)) -> Self

source§

impl Eq for Atom

source§

impl StructuralPartialEq for Atom

Auto Trait Implementations§

§

impl Freeze for Atom

§

impl RefUnwindSafe for Atom

§

impl !Send for Atom

§

impl !Sync for Atom

§

impl Unpin for Atom

§

impl UnwindSafe for Atom

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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§

default 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.
source§

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