pub enum Number {
Integer(i64),
Real(F64),
}👎Deprecated since 0.6.0-alpha.3:
match on ExprKind::Integer / ExprKind::Real directly
Expand description
Subset of ExprKind that covers number-type expression values.
§Migration
Match on ExprKind directly — no intermediate Number needed:
let expr = expr!(42);
// Before:
// if let Some(n) = expr.try_as_number() {
// match n { Number::Integer(i) => …, Number::Real(r) => … }
// }
// After:
match expr.kind() {
ExprKind::Integer(i) => println!("integer: {i}"),
ExprKind::Real(r) => println!("real: {}", r.into_inner()),
_ => {} // non-numeric expression
}To construct a number expression use Expr::from or Expr::real — see
Expr::number for the full mapping.
Variants§
Integer(i64)
👎Deprecated since 0.6.0-alpha.3:
match on ExprKind::Integer / ExprKind::Real directly
Real(F64)
👎Deprecated since 0.6.0-alpha.3:
match on ExprKind::Integer / ExprKind::Real directly
Implementations§
Trait Implementations§
impl Copy for Number
impl Eq for Number
Source§impl Ord for Number
impl Ord for Number
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Number
impl PartialOrd for Number
impl StructuralPartialEq for Number
Auto Trait Implementations§
impl Freeze for Number
impl RefUnwindSafe for Number
impl Send for Number
impl Sync for Number
impl Unpin for Number
impl UnsafeUnpin for Number
impl UnwindSafe for Number
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
Mutably borrows from an owned value. Read more