pub enum Value {
Null,
Bool(bool),
Int(i64),
Float(f64),
String(String),
DateTime(RfcDate),
Decimal(Decimal),
Duration(Duration),
StringArray(Vec<String>),
IntArray(Vec<i64>),
FloatArray(Vec<f64>),
Json(Value),
}Variants§
Null
Bool(bool)
Int(i64)
Float(f64)
String(String)
DateTime(RfcDate)
An RFC 3339 date-time, e.g. 2026-06-12T09:30:00Z. Construct with
Value::datetime to get format validation.
Decimal(Decimal)
A lossless fixed-point decimal (SQL DECIMAL-style). Construct with
Value::decimal.
Duration(Duration)
An ISO 8601 calendar/clock duration. Construct with Value::duration.
StringArray(Vec<String>)
IntArray(Vec<i64>)
FloatArray(Vec<f64>)
Json(Value)
Implementations§
Source§impl Value
impl Value
Sourcepub fn datetime(value: impl Into<String>) -> Result<Self>
pub fn datetime(value: impl Into<String>) -> Result<Self>
Creates a Value::DateTime, validating that the input is an RFC 3339
date-time such as 2026-06-12T09:30:00Z or
2026-06-12T09:30:00.123+02:00.
Sourcepub fn decimal(value: impl AsRef<str>) -> Result<Self>
pub fn decimal(value: impl AsRef<str>) -> Result<Self>
Creates a Value::Decimal, validating the decimal numeral (e.g. 3.14).
Sourcepub fn duration(value: impl AsRef<str>) -> Result<Self>
pub fn duration(value: impl AsRef<str>) -> Result<Self>
Creates a Value::Duration from an ISO 8601 duration (e.g. P1Y2MT3H).
pub fn as_decimal(&self) -> Option<&Decimal>
pub fn as_duration(&self) -> Option<&Duration>
pub fn as_str(&self) -> Option<&str>
pub fn as_datetime(&self) -> Option<&str>
pub fn as_string_array(&self) -> Option<&[String]>
pub fn as_int_array(&self) -> Option<&[i64]>
pub fn as_float_array(&self) -> Option<&[f64]>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
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>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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