pub enum PublicNumber {
Int(i64),
Float(f64),
Decimal(Decimal),
}Expand description
Represents a numeric value in SurrealDB
Numbers in SurrealDB can be integers, floating-point numbers, or decimal numbers. This enum provides type-safe representation for all numeric types.
Variants§
Int(i64)
A 64-bit signed integer
Float(f64)
A 64-bit floating-point number
Decimal(Decimal)
A decimal number with arbitrary precision
Implementations§
Source§impl Number
impl Number
Source§impl Number
impl Number
Sourcepub fn into_float(self) -> Result<f64, Error>
pub fn into_float(self) -> Result<f64, Error>
Convert this number into the given type
Sourcepub fn from_float(v: f64) -> Number
pub fn from_float(v: f64) -> Number
Create a new number from the given type
Sourcepub fn is_decimal(&self) -> bool
pub fn is_decimal(&self) -> bool
Check if this is a of the given type
Sourcepub fn into_decimal(self) -> Result<Decimal, Error>
pub fn into_decimal(self) -> Result<Decimal, Error>
Convert this number into the given type
Sourcepub fn from_decimal(v: Decimal) -> Number
pub fn from_decimal(v: Decimal) -> Number
Create a new number from the given type
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Number
impl<'de> Deserialize<'de> for Number
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Number, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Number, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Number
impl Ord for Number
Source§impl PartialOrd for Number
impl PartialOrd for Number
Source§impl Serialize for Number
impl Serialize for Number
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl SurrealValue for Number
impl SurrealValue for Number
Source§fn into_value(self) -> Value
fn into_value(self) -> Value
Converts this type into a SurrealDB value
impl Copy for Number
impl Eq 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more