pub enum Atom {
Undef,
Rational(Rational),
Irrational(Irrational),
Var(Var),
Sum(Sum),
Prod(Prod),
Pow(Pow),
Func(Func),
}
Variants§
Implementations§
source§impl Atom
impl Atom
sourcepub const fn is_undef(&self) -> bool
pub const fn is_undef(&self) -> bool
Returns true
if this value is of type Undef
. Returns false
otherwise
sourcepub const fn is_rational(&self) -> bool
pub const fn is_rational(&self) -> bool
Returns true
if this value is of type Rational
. Returns false
otherwise
sourcepub const fn is_irrational(&self) -> bool
pub const fn is_irrational(&self) -> bool
Returns true
if this value is of type Irrational
. Returns false
otherwise
sourcepub const fn is_var(&self) -> bool
pub const fn is_var(&self) -> bool
Returns true
if this value is of type Var
. Returns false
otherwise
sourcepub const fn is_sum(&self) -> bool
pub const fn is_sum(&self) -> bool
Returns true
if this value is of type Sum
. Returns false
otherwise
sourcepub const fn is_prod(&self) -> bool
pub const fn is_prod(&self) -> bool
Returns true
if this value is of type Prod
. Returns false
otherwise
source§impl Atom
impl Atom
sourcepub fn unwrap_undef(self)
pub fn unwrap_undef(self)
Unwraps this value to the Atom::Undef
variant.
Panics if this value is of any other type.
sourcepub fn unwrap_undef_ref(&self)
pub fn unwrap_undef_ref(&self)
Unwraps this reference to the Atom::Undef
variant.
Panics if this value is of any other type.
sourcepub fn unwrap_rational(self) -> Rational
pub fn unwrap_rational(self) -> Rational
Unwraps this value to the Atom::Rational
variant.
Panics if this value is of any other type.
sourcepub fn unwrap_rational_ref(&self) -> &Rational
pub fn unwrap_rational_ref(&self) -> &Rational
Unwraps this reference to the Atom::Rational
variant.
Panics if this value is of any other type.
sourcepub fn unwrap_irrational(self) -> Irrational
pub fn unwrap_irrational(self) -> Irrational
Unwraps this value to the Atom::Irrational
variant.
Panics if this value is of any other type.
sourcepub fn unwrap_irrational_ref(&self) -> &Irrational
pub fn unwrap_irrational_ref(&self) -> &Irrational
Unwraps this reference to the Atom::Irrational
variant.
Panics if this value is of any other type.
sourcepub fn unwrap_var(self) -> Var
pub fn unwrap_var(self) -> Var
Unwraps this value to the Atom::Var
variant.
Panics if this value is of any other type.
sourcepub fn unwrap_var_ref(&self) -> &Var
pub fn unwrap_var_ref(&self) -> &Var
Unwraps this reference to the Atom::Var
variant.
Panics if this value is of any other type.
sourcepub fn unwrap_sum(self) -> Sum
pub fn unwrap_sum(self) -> Sum
Unwraps this value to the Atom::Sum
variant.
Panics if this value is of any other type.
sourcepub fn unwrap_sum_ref(&self) -> &Sum
pub fn unwrap_sum_ref(&self) -> &Sum
Unwraps this reference to the Atom::Sum
variant.
Panics if this value is of any other type.
sourcepub fn unwrap_prod(self) -> Prod
pub fn unwrap_prod(self) -> Prod
Unwraps this value to the Atom::Prod
variant.
Panics if this value is of any other type.
sourcepub fn unwrap_prod_ref(&self) -> &Prod
pub fn unwrap_prod_ref(&self) -> &Prod
Unwraps this reference to the Atom::Prod
variant.
Panics if this value is of any other type.
sourcepub fn unwrap_pow(self) -> Pow
pub fn unwrap_pow(self) -> Pow
Unwraps this value to the Atom::Pow
variant.
Panics if this value is of any other type.
sourcepub fn unwrap_pow_ref(&self) -> &Pow
pub fn unwrap_pow_ref(&self) -> &Pow
Unwraps this reference to the Atom::Pow
variant.
Panics if this value is of any other type.
sourcepub fn unwrap_func(self) -> Func
pub fn unwrap_func(self) -> Func
Unwraps this value to the Atom::Func
variant.
Panics if this value is of any other type.
sourcepub fn unwrap_func_ref(&self) -> &Func
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
impl Atom
sourcepub fn try_unwrap_undef(self) -> Result<(), TryUnwrapError<Self>>
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.
sourcepub fn try_unwrap_undef_ref(&self) -> Result<(), TryUnwrapError<&Self>>
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.
sourcepub fn try_unwrap_rational(self) -> Result<Rational, TryUnwrapError<Self>>
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.
sourcepub fn try_unwrap_rational_ref(
&self,
) -> Result<&Rational, TryUnwrapError<&Self>>
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.
sourcepub fn try_unwrap_irrational(self) -> Result<Irrational, TryUnwrapError<Self>>
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.
sourcepub fn try_unwrap_irrational_ref(
&self,
) -> Result<&Irrational, TryUnwrapError<&Self>>
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.
sourcepub fn try_unwrap_var(self) -> Result<Var, TryUnwrapError<Self>>
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.
sourcepub fn try_unwrap_var_ref(&self) -> Result<&Var, TryUnwrapError<&Self>>
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.
sourcepub fn try_unwrap_sum(self) -> Result<Sum, TryUnwrapError<Self>>
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.
sourcepub fn try_unwrap_sum_ref(&self) -> Result<&Sum, TryUnwrapError<&Self>>
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.
sourcepub fn try_unwrap_prod(self) -> Result<Prod, TryUnwrapError<Self>>
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.
sourcepub fn try_unwrap_prod_ref(&self) -> Result<&Prod, TryUnwrapError<&Self>>
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.
sourcepub fn try_unwrap_pow(self) -> Result<Pow, TryUnwrapError<Self>>
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.
sourcepub fn try_unwrap_pow_ref(&self) -> Result<&Pow, TryUnwrapError<&Self>>
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.
sourcepub fn try_unwrap_func(self) -> Result<Func, TryUnwrapError<Self>>
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.
sourcepub fn try_unwrap_func_ref(&self) -> Result<&Func, TryUnwrapError<&Self>>
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
impl Atom
pub const UNDEF: Atom = Atom::Undef
pub const MINUS_TWO: Atom = _
pub const MINUS_ONE: Atom = _
pub const ZERO: Atom = _
pub const ONE: Atom = _
pub const TWO: Atom = _
pub const PI: Atom = _
pub const E: Atom = _
pub fn is_zero(&self) -> bool
pub fn is_one(&self) -> bool
pub fn is_min_one(&self) -> bool
pub fn is_pi(&self) -> bool
pub fn is_e(&self) -> bool
pub fn is_neg(&self) -> bool
pub fn is_pos(&self) -> bool
pub fn is_int(&self) -> bool
pub fn is_even(&self) -> bool
pub fn is_odd(&self) -> bool
pub fn is_number(&self) -> bool
pub fn is_real(&self) -> bool
pub fn is_irreducible(&self) -> bool
pub fn is_rational_and(&self, cond: impl Fn(&Rational) -> bool) -> bool
pub fn is_const(&self) -> bool
pub fn is_sin(&self) -> bool
pub fn is_cos(&self) -> bool
pub fn try_unwrap_int(&self) -> Option<i128>
pub fn unwrap_int(&self) -> i128
pub fn try_as_real(&self) -> Option<Real>
pub fn for_each_arg<'a>(&'a self, func: impl FnMut(&'a Expr))
pub fn fmt_ast(&self) -> FmtAtom
Trait Implementations§
source§impl<'de> Deserialize<'de> for Atom
impl<'de> Deserialize<'de> for Atom
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 From<Irrational> for Atom
impl From<Irrational> for Atom
source§fn from(value: Irrational) -> Self
fn from(value: Irrational) -> Self
source§impl Ord for Atom
impl Ord for Atom
source§impl PartialOrd for Atom
impl PartialOrd for Atom
source§impl SymbolicExpr for Atom
impl SymbolicExpr for Atom
fn args(&self) -> &[Expr]
fn args_mut(&mut self) -> &mut [Expr]
source§fn reduce(&self) -> Expr
fn reduce(&self) -> Expr
fn is_atom(&self) -> bool
fn n_args(&self) -> usize
fn iter_args(&self) -> impl Iterator<Item = &Expr>
fn map_args(self, map_fn: impl Fn(&mut Expr)) -> Self
impl Eq for Atom
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)