pub struct Value { /* private fields */ }Expand description
Single typed runtime value with private storage representation.
Construction and access are expressed through methods and conversions. The concrete enum representation is private so storage optimizations do not become part of the public API.
§Examples
use qubit_value::Value;
let value = Value::from(42_i32);
assert_eq!(value.get_int32().unwrap(), 42);Implementations§
Source§impl Value
impl Value
Sourcepub fn BigInteger(value: BigInt) -> Self
pub fn BigInteger(value: BigInt) -> Self
Sourcepub fn BigDecimal(value: BigDecimal) -> Self
pub fn BigDecimal(value: BigDecimal) -> Self
Sourcepub fn DateTime(value: NaiveDateTime) -> Self
pub fn DateTime(value: NaiveDateTime) -> Self
Source§impl Value
impl Value
Sourcepub fn get_ref<'a, T: ?Sized>(&'a self) -> ValueResult<&'a T>
pub fn get_ref<'a, T: ?Sized>(&'a self) -> ValueResult<&'a T>
Strictly borrows a stored scalar without allocating.
Sourcepub fn hash_with_json_budget<H, R, Q>(
&self,
state: &mut H,
budget: &mut JsonValueBudget<R, Q>,
) -> Result<(), MeasuredBudgetError<R, Q>>
pub fn hash_with_json_budget<H, R, Q>( &self, state: &mut H, budget: &mut JsonValueBudget<R, Q>, ) -> Result<(), MeasuredBudgetError<R, Q>>
Hashes this value while applying budget to a JSON payload.
§Type Parameters
H- Hasher receiving the semantic value identity.R- Resource identifier used by the JSON budget.Q- Quantity type used by the JSON budget.
§Parameters
state- Hasher that receives the same identity representation asHash::hash.budget- Mutable JSON traversal budget, used only when this value contains a JSON payload.
§Returns
Ok(()) after the complete semantic identity is hashed.
§Errors
Returns qubit_budget::MeasuredBudgetError when the JSON payload
exceeds a configured limit. On error, neither state nor the committed
portion of budget is modified. A hasher panic also drops the
staged budget transaction.
§Examples
use std::collections::hash_map::DefaultHasher;
use qubit_budget::{ResourceLimit, StructureLimits};
use qubit_budget::json::{JsonResource, JsonValueBudget, JsonValueLimits};
use qubit_value::Value;
let value = Value::Json(serde_json::json!([null]));
let structure = StructureLimits::<JsonResource, usize>::builder().nodes_limit(
ResourceLimit::new(JsonResource::Nodes, 1_usize),
).build();
let mut budget = JsonValueBudget::new(
JsonValueLimits::builder().structure_limits(structure).build(),
);
let mut hasher = DefaultHasher::new();
assert!(value.hash_with_json_budget(&mut hasher, &mut budget).is_err());
drop(hasher);
// The rejected value did not consume committed budget state.Source§impl Value
Unified getter generation macro
impl Value
Unified getter generation macro
Supports two modes:
copy:- For types implementing the Copy trait, directly returns the valueref:- For non-Copy types, returns a reference
§Documentation Comment Support
The macro automatically extracts preceding documentation comments, so
you can add /// comments before macro invocations.
Sourcepub fn new<T>(value: T) -> Selfwhere
T: Into<Self>,
pub fn new<T>(value: T) -> Selfwhere
T: Into<Self>,
Generic constructor method
Creates a Value from any supported type, avoiding direct use of
enum variants.
§Supported Generic Types
Value::new<T>(value) currently supports the following T:
boolchari8,i16,i32,i64,i128u8,u16,u32,u64,u128f32,f64String,&strNaiveDate,NaiveTime,NaiveDateTime,DateTime<Utc>BigInt,BigDecimalDurationUrlHashMap<String, String>serde_json::Value
§Type Parameters
T- The type of the value to wrap
§Parameters
value- Value to wrap.
§Returns
Returns a Value wrapping the given value
§Examples
use qubit_value::Value;
// Basic types
let v = Value::new(42i32);
assert_eq!(v.get_int32().unwrap(), 42);
let v = Value::new(true);
assert_eq!(v.get_bool().unwrap(), true);
// String
let v = Value::new("hello".to_string());
assert_eq!(v.get_string().unwrap(), "hello");Sourcepub fn get<T>(&self) -> ValueResult<T>where
for<'a> T: TryFrom<&'a Self, Error = ValueError>,
pub fn get<T>(&self) -> ValueResult<T>where
for<'a> T: TryFrom<&'a Self, Error = ValueError>,
Generic getter method.
Performs a strict typed read of the stored value as T.
get<T>() performs strict type matching. It does not do cross-type
conversion.
For example, Value::Int32(42).get::<i64>() fails, while
Value::Int32(42).to::<i64>() succeeds.
§Supported Generic Types
Value::get<T>() currently supports the following T:
boolchari8,i16,i32,i64,i128u8,u16,u32,u64,u128f32,f64StringNaiveDate,NaiveTime,NaiveDateTime,DateTime<Utc>BigInt,BigDecimalDurationUrlHashMap<String, String>serde_json::Value
§Type Parameters
T- The target type to retrieve
§Returns
Returns the stored value when its type matches T.
§Errors
Returns ValueError::Missing when the value is unset with the
requested type, or ValueError::TypeMismatch when the stored type
differs from T.
§Examples
use qubit_value::Value;
let value = Value::Int32(42);
// Through type inference
let num: i32 = value.get().unwrap();
assert_eq!(num, 42);
// Explicitly specify type parameter
let num = value.get::<i32>().unwrap();
assert_eq!(num, 42);
// Different type
let text = Value::String("hello".to_string());
let s: String = text.get().unwrap();
assert_eq!(s, "hello");
// Boolean value
let flag = Value::Bool(true);
let b: bool = flag.get().unwrap();
assert_eq!(b, true);Sourcepub fn get_or<T>(&self, default: impl IntoValueDefault<T>) -> ValueResult<T>where
for<'a> T: TryFrom<&'a Self, Error = ValueError>,
pub fn get_or<T>(&self, default: impl IntoValueDefault<T>) -> ValueResult<T>where
for<'a> T: TryFrom<&'a Self, Error = ValueError>,
Generic getter method with a default value.
Returns the supplied default only when this value is unset. Type mismatches and conversion errors are still returned as errors.
§Type Parameters
T- Target type for the strict read and default value.
§Parameters
default- Lazily materialized value used only whenselfis unset.
§Returns
The stored value, or default when the value is unset.
§Errors
Returns ValueError::TypeMismatch when the stored type differs from
T.
Sourcepub fn get_or_else<T, F>(&self, default: F) -> ValueResult<T>
pub fn get_or_else<T, F>(&self, default: F) -> ValueResult<T>
Strictly reads this value or calls default only when it is unset.
§Type Parameters
T- Target type for the strict read and fallback value.F- Deferred fallback producingT.
§Parameters
default- Callback invoked only when this value is unset.
§Returns
The stored value, or the callback result for an unset value.
§Errors
Returns ValueError::TypeMismatch when the stored type differs from
T; the callback is not invoked in that case.
Sourcepub fn to<T>(&self) -> ValueResult<T>where
T: DataConversionTarget,
pub fn to<T>(&self) -> ValueResult<T>where
T: DataConversionTarget,
Converts the stored value to another supported data type.
This method delegates to the authoritative conversion contract in
qubit-datatype.
The enabled rich-type features determine which source and target
families are available. An unset value is reported as a structured
missing-value conversion error.
Unlike Self::get, this method permits conversions supported by
qubit_datatype::DataConverter and applies
qubit_datatype::ConversionPolicy and
qubit_datatype::ConversionLimits.
§Type Parameters
T- Target type supported by the shared conversion layer.
§Returns
The converted value.
§Errors
Returns a mapped conversion error when the value is unset, the
conversion is unsupported, or the source is invalid for T.
§Examples
use qubit_value::Value;
let value = Value::Int32(42);
assert_eq!(value.to::<i64>().unwrap(), 42);
assert_eq!(value.to::<String>().unwrap(), "42");Sourcepub fn to_or<T>(&self, default: impl IntoValueDefault<T>) -> ValueResult<T>where
T: DataConversionTarget,
pub fn to_or<T>(&self, default: impl IntoValueDefault<T>) -> ValueResult<T>where
T: DataConversionTarget,
Converts this value to T, or returns default when storage is unset
or conversion reports a missing value.
Conversion failures from concrete values are preserved.
§Type Parameters
T- Target conversion type.
§Parameters
default- Lazily materialized value used for unset or conversion- missing storage.
§Returns
The converted value, or default for an unset or conversion-missing
value.
§Errors
Returns a mapped conversion error for concrete values that cannot be
converted to T.
Sourcepub fn to_or_else<T, F>(&self, default: F) -> ValueResult<T>where
T: DataConversionTarget,
F: FnOnce() -> T,
pub fn to_or_else<T, F>(&self, default: F) -> ValueResult<T>where
T: DataConversionTarget,
F: FnOnce() -> T,
Converts this value to T, or calls default when storage is unset or
conversion reports a missing value.
§Type Parameters
T- Target conversion type.F- Deferred fallback producingT.
§Parameters
default- Callback invoked only when conversion reports a missing value.
§Returns
The converted value, or the callback result for an unset or conversion-missing value.
§Errors
Preserves conversion errors from concrete values without invoking the callback.
Sourcepub fn to_with<T>(
&self,
policy: &ConversionPolicy,
limits: &ConversionLimits,
) -> ValueResult<T>where
T: DataConversionTarget,
pub fn to_with<T>(
&self,
policy: &ConversionPolicy,
limits: &ConversionLimits,
) -> ValueResult<T>where
T: DataConversionTarget,
Converts this value to T using the provided conversion policy and
limits.
This method uses the shared qubit_datatype conversion layer
directly, so policy settings such as string trimming, blank string
handling, and boolean aliases are applied consistently with other
value containers.
§Type Parameters
T- The target type to convert to.
§Parameters
policy- Conversion policy forwarded to the shared converter.limits- Conversion limits forwarded to the shared converter.
§Returns
Returns the converted value on success.
§Errors
Returns a crate::ValueError when the value is missing, unsupported,
or invalid for T under the provided policy and limits.
Sourcepub fn to_in<T>(&self, session: &mut ConversionSession<'_>) -> ValueResult<T>where
T: DataConversionTarget,
pub fn to_in<T>(&self, session: &mut ConversionSession<'_>) -> ValueResult<T>where
T: DataConversionTarget,
Converts this value to T while charging an existing conversion
session.
§Type Parameters
T- Target type supported by the shared conversion layer.
§Parameters
session- Caller-owned session providing policy, limits, and budget.
§Returns
The converted value.
§Errors
Returns a mapped conversion error when the value is missing, unsupported, invalid, or exceeds the session budget.
Sourcepub fn to_or_with<T>(
&self,
default: impl IntoValueDefault<T>,
policy: &ConversionPolicy,
limits: &ConversionLimits,
) -> ValueResult<T>where
T: DataConversionTarget,
pub fn to_or_with<T>(
&self,
default: impl IntoValueDefault<T>,
policy: &ConversionPolicy,
limits: &ConversionLimits,
) -> ValueResult<T>where
T: DataConversionTarget,
Converts this value to T using conversion policy and limits, or
returns default when storage is unset or conversion reports a
missing value.
Conversion failures from concrete values are preserved.
§Type Parameters
T- Target conversion type.
§Parameters
default- Lazily materialized value used for unset or conversion- missing storage.policy- Conversion policy forwarded to the shared converter.limits- Conversion limits forwarded to the shared converter.
§Returns
The converted value, or default for an unset or conversion-missing
value.
§Errors
Returns a mapped conversion error for concrete values that cannot be converted under the provided policy and limits.
Sourcepub fn to_or_else_with<T, F>(
&self,
default: F,
policy: &ConversionPolicy,
limits: &ConversionLimits,
) -> ValueResult<T>where
T: DataConversionTarget,
F: FnOnce() -> T,
pub fn to_or_else_with<T, F>(
&self,
default: F,
policy: &ConversionPolicy,
limits: &ConversionLimits,
) -> ValueResult<T>where
T: DataConversionTarget,
F: FnOnce() -> T,
Converts this value with the provided policy and limits, or calls
default when storage is unset or conversion reports a missing
value.
§Type Parameters
T- Target conversion type.F- Deferred fallback producingT.
§Parameters
default- Callback invoked only for a missing source value.policy- Conversion policy forwarded to the shared converter.limits- Conversion limits forwarded to the shared converter.
§Returns
The converted value, or the callback result for an unset or conversion-missing value.
§Errors
Preserves concrete-value conversion errors without invoking the callback.
Sourcepub fn set<T>(&mut self, value: T)where
T: Into<Self>,
pub fn set<T>(&mut self, value: T)where
T: Into<Self>,
Generic setter method
Replaces the current value with any supported input value.
This operation updates the stored type to T when needed. It does not
perform runtime type-mismatch validation against the previous variant.
§Supported Generic Types
Value::set<T>(value) currently supports the following T:
boolchari8,i16,i32,i64,i128u8,u16,u32,u64,u128f32,f64String,&strNaiveDate,NaiveTime,NaiveDateTime,DateTime<Utc>BigInt,BigDecimalDurationUrlHashMap<String, String>serde_json::Value
§Type Parameters
T- Input type convertible intoValue.
§Parameters
value- The value to set
§Compile-time restriction
Unsupported input types fail to compile because they do not implement
Into<Value>.
§Examples
use qubit_datatype::DataType;
use qubit_value::Value;
let mut value = Value::Unset(DataType::Int32);
// Through type inference
value.set(42i32);
assert_eq!(value.get_int32().unwrap(), 42);
// Explicitly specify type parameter
value.set::<i32>(100);
assert_eq!(value.get_int32().unwrap(), 100);
// String type
let mut text = Value::Unset(DataType::String);
text.set("hello".to_string());
assert_eq!(text.get_string().unwrap(), "hello");Sourcepub fn data_type(&self) -> DataType
pub fn data_type(&self) -> DataType
Get the data type of the value
§Returns
Returns the data type corresponding to this value
§Examples
use qubit_datatype::DataType;
use qubit_value::Value;
let value = Value::Int32(42);
assert_eq!(value.data_type(), DataType::Int32);
let empty = Value::Unset(DataType::String);
assert_eq!(empty.data_type(), DataType::String);#![deny(unused_must_use)]
use qubit_value::Value;
Value::new(42_i32).data_type();Sourcepub fn is_unset(&self) -> bool
pub fn is_unset(&self) -> bool
Tests whether this container has no concrete value.
§Returns
Returns true only for Value::Unset. An empty string, map, or JSON
container is still a concrete value and returns false.
§Examples
use qubit_datatype::DataType;
use qubit_value::Value;
let value = Value::Int32(42);
assert!(!value.is_unset());
let empty = Value::Unset(DataType::String);
assert!(empty.is_unset());Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Tests whether a concrete value belongs to the numeric type family.
An unset value returns false, even when its declared type is numeric.
§Returns
true for concrete numeric variants; otherwise false.
Sourcepub fn set_type(&mut self, data_type: DataType)
pub fn set_type(&mut self, data_type: DataType)
Set the data type
If the new type differs from the current type, clears the value and sets the new type.
§Parameters
data_type- The data type to set
§Examples
use qubit_datatype::DataType;
use qubit_value::Value;
let mut value = Value::Int32(42);
value.set_type(DataType::String);
assert!(value.is_unset());
assert_eq!(value.data_type(), DataType::String);Source§impl Value
impl Value
Sourcepub fn to_json_value(&self) -> ValueResult<Value>
pub fn to_json_value(&self) -> ValueResult<Value>
Projects this typed value to its natural JSON representation.
This differs from the tagged crate::ValueWireV1 representation: for
example, Value::Int32(42) projects to the JSON number 42.
§Returns
The natural JSON representation of this value.
§Errors
Returns a structured conversion error for values JSON cannot represent, including non-finite floating-point values and inexact durations.
Sourcepub fn to_json_value_with(
&self,
policy: &ConversionPolicy,
limits: &ConversionLimits,
) -> ValueResult<Value>
pub fn to_json_value_with( &self, policy: &ConversionPolicy, limits: &ConversionLimits, ) -> ValueResult<Value>
Projects this typed value using explicit conversion policy and limits.
§Parameters
policy- Controls duration units and precision-loss behavior.limits- Bounds conversion resource consumption.
§Returns
The natural JSON representation of this value.
§Errors
Returns a structured conversion error when JSON projection or duration formatting violates the requested policy or limits.
Source§impl Value
impl Value
Sourcepub fn from_json_value(json: Value) -> Self
pub fn from_json_value(json: Value) -> Self
Sourcepub fn from_serializable<T: ?Sized + Serialize>(value: &T) -> ValueResult<Self>
pub fn from_serializable<T: ?Sized + Serialize>(value: &T) -> ValueResult<Self>
Creates a Value from any serializable value by converting it to JSON.
§Type Parameters
T- Any type implementingSerialize.
§Parameters
value- The value to serialize into JSON.
§Returns
A Value::Json containing the serialized representation.
§Errors
Returns ValueError::Conversion with
A non-finite reason is returned when any nested float is non-finite, an
out-of-range reason when an integer exceeds the strict JSON range, or a
serialization reason for every other unsupported Serde representation.
Sourcepub fn get_bool(&self) -> ValueResult<bool>
pub fn get_bool(&self) -> ValueResult<bool>
Get boolean value
§Returns
If types match, returns the boolean value; see # Errors.
§Examples
use qubit_value::Value;
let value = Value::Bool(true);
assert_eq!(value.get_bool().unwrap(), true);§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_char(&self) -> ValueResult<char>
pub fn get_char(&self) -> ValueResult<char>
Get character value
§Returns
If types match, returns the character value; see # Errors.
§Examples
use qubit_value::Value;
let value = Value::Char('A');
assert_eq!(value.get_char().unwrap(), 'A');§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_int8(&self) -> ValueResult<i8>
pub fn get_int8(&self) -> ValueResult<i8>
Get int8 value
§Returns
If types match, returns the int8 value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_int16(&self) -> ValueResult<i16>
pub fn get_int16(&self) -> ValueResult<i16>
Get int16 value
§Returns
If types match, returns the int16 value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_int32(&self) -> ValueResult<i32>
pub fn get_int32(&self) -> ValueResult<i32>
Get int32 value
§Returns
If types match, returns the int32 value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_int64(&self) -> ValueResult<i64>
pub fn get_int64(&self) -> ValueResult<i64>
Get int64 value
§Returns
If types match, returns the int64 value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_int128(&self) -> ValueResult<i128>
pub fn get_int128(&self) -> ValueResult<i128>
Get int128 value
§Returns
If types match, returns the int128 value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_uint8(&self) -> ValueResult<u8>
pub fn get_uint8(&self) -> ValueResult<u8>
Get uint8 value
§Returns
If types match, returns the uint8 value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_uint16(&self) -> ValueResult<u16>
pub fn get_uint16(&self) -> ValueResult<u16>
Get uint16 value
§Returns
If types match, returns the uint16 value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_uint32(&self) -> ValueResult<u32>
pub fn get_uint32(&self) -> ValueResult<u32>
Get uint32 value
§Returns
If types match, returns the uint32 value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_uint64(&self) -> ValueResult<u64>
pub fn get_uint64(&self) -> ValueResult<u64>
Get uint64 value
§Returns
If types match, returns the uint64 value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_uint128(&self) -> ValueResult<u128>
pub fn get_uint128(&self) -> ValueResult<u128>
Get uint128 value
§Returns
If types match, returns the uint128 value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_float32(&self) -> ValueResult<f32>
pub fn get_float32(&self) -> ValueResult<f32>
Get float32 value
§Returns
If types match, returns the float32 value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_float64(&self) -> ValueResult<f64>
pub fn get_float64(&self) -> ValueResult<f64>
Get float64 value
§Returns
If types match, returns the float64 value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_string(&self) -> ValueResult<&str>
pub fn get_string(&self) -> ValueResult<&str>
Get string reference
§Returns
If types match, returns a reference to the string; see # Errors.
§Examples
use qubit_value::Value;
let value = Value::String("hello".to_string());
assert_eq!(value.get_string().unwrap(), "hello");§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_date(&self) -> ValueResult<NaiveDate>
pub fn get_date(&self) -> ValueResult<NaiveDate>
Get date value
§Returns
If types match, returns the date value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_time(&self) -> ValueResult<NaiveTime>
pub fn get_time(&self) -> ValueResult<NaiveTime>
Get time value
§Returns
If types match, returns the time value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_datetime(&self) -> ValueResult<NaiveDateTime>
pub fn get_datetime(&self) -> ValueResult<NaiveDateTime>
Get datetime value
§Returns
If types match, returns the datetime value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_instant(&self) -> ValueResult<DateTime<Utc>>
pub fn get_instant(&self) -> ValueResult<DateTime<Utc>>
Get UTC instant value
§Returns
If types match, returns the UTC instant value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_biginteger(&self) -> ValueResult<BigInt>
pub fn get_biginteger(&self) -> ValueResult<BigInt>
Get big integer value.
This method returns a cloned BigInt. Use
Value::get_biginteger_ref to borrow the stored value without
cloning.
§Returns
If types match, returns the big integer value; see # Errors.
§Examples
use qubit_value::Value;
use num_bigint::BigInt;
let value = Value::BigInteger(BigInt::from(123456789));
assert_eq!(value.get_biginteger().unwrap(), BigInt::from(123456789));§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_bigdecimal(&self) -> ValueResult<BigDecimal>
pub fn get_bigdecimal(&self) -> ValueResult<BigDecimal>
Get big decimal value.
This method returns a cloned BigDecimal. Use
Value::get_bigdecimal_ref to borrow the stored value without
cloning.
§Returns
If types match, returns the big decimal value; see # Errors.
§Examples
use std::str::FromStr;
use bigdecimal::BigDecimal;
use qubit_value::Value;
let bd = BigDecimal::from_str("123.456").unwrap();
let value = Value::BigDecimal(bd.clone());
assert_eq!(value.get_bigdecimal().unwrap(), bd);§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_duration(&self) -> ValueResult<Duration>
pub fn get_duration(&self) -> ValueResult<Duration>
Get Duration value
§Returns
If types match, returns the Duration value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_url(&self) -> ValueResult<Url>
pub fn get_url(&self) -> ValueResult<Url>
Get URL value.
This method returns a cloned Url. Use Value::get_url_ref to
borrow the stored value without cloning.
§Returns
If types match, returns the URL value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_string_map(&self) -> ValueResult<HashMap<String, String>>
pub fn get_string_map(&self) -> ValueResult<HashMap<String, String>>
Get string map value.
This method returns a cloned HashMap<String, String>. Use
Value::get_string_map_ref to borrow the stored value without
cloning.
§Returns
If types match, returns the string map value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_json(&self) -> ValueResult<Value>
pub fn get_json(&self) -> ValueResult<Value>
Get JSON value.
This method returns a cloned serde_json::Value. Use
Value::get_json_ref to borrow the stored value without cloning.
§Returns
If types match, returns the JSON value; see # Errors.
§Errors
Returns ValueError::Missing when the value is unset with
the requested type, or ValueError::TypeMismatch when the
stored data type differs.
Sourcepub fn get_biginteger_ref(&self) -> ValueResult<&BigInt>
pub fn get_biginteger_ref(&self) -> ValueResult<&BigInt>
Borrow the inner BigInt without cloning.
§Returns
A shared reference to the stored integer.
§Errors
Returns ValueError::Missing when the value is unset with
DataType::BigInteger, or ValueError::TypeMismatch when the stored
data type differs.
Sourcepub fn get_bigdecimal_ref(&self) -> ValueResult<&BigDecimal>
pub fn get_bigdecimal_ref(&self) -> ValueResult<&BigDecimal>
Borrow the inner BigDecimal without cloning.
§Returns
A shared reference to the stored decimal.
§Errors
Returns ValueError::Missing when the value is unset with
DataType::BigDecimal, or ValueError::TypeMismatch when the stored
data type differs.
Sourcepub fn get_url_ref(&self) -> ValueResult<&Url>
pub fn get_url_ref(&self) -> ValueResult<&Url>
Borrow the inner Url without cloning.
§Returns
A shared reference to the stored URL.
§Errors
Returns ValueError::Missing when the value is unset with
DataType::Url, or ValueError::TypeMismatch when the stored data
type differs.
Sourcepub fn get_string_map_ref(&self) -> ValueResult<&HashMap<String, String>>
pub fn get_string_map_ref(&self) -> ValueResult<&HashMap<String, String>>
Borrow the inner HashMap<String, String> without cloning.
§Returns
A shared reference to the stored string map.
§Errors
Returns ValueError::Missing when the value is unset with
DataType::StringMap, or ValueError::TypeMismatch when the stored
data type differs.
Sourcepub fn get_json_ref(&self) -> ValueResult<&Value>
pub fn get_json_ref(&self) -> ValueResult<&Value>
Borrow the inner JSON value without cloning.
§Returns
A shared reference to the stored JSON value.
§Errors
Returns ValueError::Missing when the value is unset with
DataType::Json, or ValueError::TypeMismatch when the stored data
type differs.
Sourcepub fn deserialize_json<T: DeserializeOwned>(&self) -> ValueResult<T>
pub fn deserialize_json<T: DeserializeOwned>(&self) -> ValueResult<T>
Deserialize the inner JSON value into a target type.
Only works when self is Value::Json(...).
§Type Parameters
T- The target type implementingDeserializeOwned.
§Returns
Returns Ok(T) on success.
§Errors
Returns ValueError::Missing when this value is
Value::Unset(DataType::Json),
ValueError::TypeMismatch when this value has a non-JSON data type,
or ValueError::Conversion when JSON deserialization fails.
Source§impl Value
impl Value
Sourcepub fn is_nan(&self) -> bool
pub fn is_nan(&self) -> bool
Tests whether this value is a concrete floating-point NaN.
Non-floating-point values and unset values return false.
§Returns
true only for concrete Float32 or Float64 NaN values.
Sourcepub fn numeric_cmp(
&self,
other: &Self,
policy: NumericComparisonPolicy,
) -> Result<Ordering, NumericComparisonError>
pub fn numeric_cmp( &self, other: &Self, policy: NumericComparisonPolicy, ) -> Result<Ordering, NumericComparisonError>
Compares concrete numeric values across representation variants.
This operation is separate from PartialEq: equality preserves enum
representation identity, while numeric comparison compares mathematical
values under an explicit policy.
NumericComparisonPolicy::Approximate orders primitive infinities
separately. When a finite primitive float participates, it attempts to
project both operands to finite f64 values; if either operand cannot
be projected that way, comparison falls back to the exact path.
Projected comparison is pair-dependent and not transitive across
mixed representations. Do not use it to implement Ord, sort or
group values, or construct ordered-map or ordered-set keys. Use
NumericComparisonPolicy::Exact for deterministic ordering.
Validation is deterministic: missing operands are checked from left to right, followed by concrete operand types from left to right, and then NaN positions.
§Parameters
other- Right numeric operand.policy- Exact or approximate numeric comparison policy.
§Returns
The mathematical ordering of the two concrete, non-NaN numeric operands.
§Errors
Returns NumericComparisonError::LeftMissing or
NumericComparisonError::RightMissing when the corresponding operand
is unset. Returns NumericComparisonError::LeftNotNumeric or
NumericComparisonError::RightNotNumeric when the corresponding
concrete operand is not numeric. Returns
NumericComparisonError::LeftNaN,
NumericComparisonError::RightNaN, or
NumericComparisonError::BothNaN according to the position of NaN
operands. Missing operands are checked left-to-right, then concrete
operand types are checked left-to-right, and finally NaN positions are
classified. After these checks the lower-level comparator must be able
to order the remaining numeric operands.
Trait Implementations§
impl Eq for Value
Source§impl<'a> From<&'a Value> for DataConverter<'a>
impl<'a> From<&'a Value> for DataConverter<'a>
Source§impl From<BigDecimal> for Value
Available on crate feature big-decimal only.
impl From<BigDecimal> for Value
big-decimal only.Source§fn from(value: BigDecimal) -> Self
fn from(value: BigDecimal) -> Self
Source§impl From<NaiveDateTime> for Value
Available on crate feature chrono only.
impl From<NaiveDateTime> for Value
chrono only.Source§fn from(value: NaiveDateTime) -> Self
fn from(value: NaiveDateTime) -> Self
Source§impl From<Value> for MultiValues
impl From<Value> for MultiValues
Source§impl From<Value> for ValueContainer
impl From<Value> for ValueContainer
Source§impl Redact for Value
impl Redact for Value
Source§fn write_redacted(&self, writer: &mut RedactionWriter<'_>)
fn write_redacted(&self, writer: &mut RedactionWriter<'_>)
Writes one value through the shared structured writer.
Source§impl<'a> TryFrom<&'a Value> for &'a bool
impl<'a> TryFrom<&'a Value> for &'a bool
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a char
impl<'a> TryFrom<&'a Value> for &'a char
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a i8
impl<'a> TryFrom<&'a Value> for &'a i8
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a i16
impl<'a> TryFrom<&'a Value> for &'a i16
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a i32
impl<'a> TryFrom<&'a Value> for &'a i32
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a i64
impl<'a> TryFrom<&'a Value> for &'a i64
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a i128
impl<'a> TryFrom<&'a Value> for &'a i128
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a u8
impl<'a> TryFrom<&'a Value> for &'a u8
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a u16
impl<'a> TryFrom<&'a Value> for &'a u16
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a u32
impl<'a> TryFrom<&'a Value> for &'a u32
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a u64
impl<'a> TryFrom<&'a Value> for &'a u64
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a u128
impl<'a> TryFrom<&'a Value> for &'a u128
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a f32
impl<'a> TryFrom<&'a Value> for &'a f32
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a f64
impl<'a> TryFrom<&'a Value> for &'a f64
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a BigInt
Available on crate feature big-integer only.
impl<'a> TryFrom<&'a Value> for &'a BigInt
big-integer only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a BigDecimal
Available on crate feature big-decimal only.
impl<'a> TryFrom<&'a Value> for &'a BigDecimal
big-decimal only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a String
impl<'a> TryFrom<&'a Value> for &'a String
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a NaiveDate
Available on crate feature chrono only.
impl<'a> TryFrom<&'a Value> for &'a NaiveDate
chrono only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a NaiveTime
Available on crate feature chrono only.
impl<'a> TryFrom<&'a Value> for &'a NaiveTime
chrono only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a NaiveDateTime
Available on crate feature chrono only.
impl<'a> TryFrom<&'a Value> for &'a NaiveDateTime
chrono only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a DateTime<Utc>
Available on crate feature chrono only.
impl<'a> TryFrom<&'a Value> for &'a DateTime<Utc>
chrono only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a Duration
impl<'a> TryFrom<&'a Value> for &'a Duration
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a Url
Available on crate feature url only.
impl<'a> TryFrom<&'a Value> for &'a Url
url only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a HashMap<String, String>
impl<'a> TryFrom<&'a Value> for &'a HashMap<String, String>
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a Value
Available on crate feature json only.
impl<'a> TryFrom<&'a Value> for &'a Value
json only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for &'a str
impl<'a> TryFrom<&'a Value> for &'a str
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Source§impl<'a> TryFrom<&'a Value> for ValueWirePayloadRefV1<'a>
impl<'a> TryFrom<&'a Value> for ValueWirePayloadRefV1<'a>
Source§impl<'a> TryFrom<&'a Value> for ValueWireRefV1<'a>
impl<'a> TryFrom<&'a Value> for ValueWireRefV1<'a>
Source§impl TryFrom<&Value> for bool
impl TryFrom<&Value> for bool
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for char
impl TryFrom<&Value> for char
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for i8
impl TryFrom<&Value> for i8
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for i16
impl TryFrom<&Value> for i16
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for i32
impl TryFrom<&Value> for i32
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for i64
impl TryFrom<&Value> for i64
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for i128
impl TryFrom<&Value> for i128
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for u8
impl TryFrom<&Value> for u8
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for u16
impl TryFrom<&Value> for u16
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for u32
impl TryFrom<&Value> for u32
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for u64
impl TryFrom<&Value> for u64
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for u128
impl TryFrom<&Value> for u128
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for f32
impl TryFrom<&Value> for f32
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for f64
impl TryFrom<&Value> for f64
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for BigInt
Available on crate feature big-integer only.
impl TryFrom<&Value> for BigInt
big-integer only.Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for BigDecimal
Available on crate feature big-decimal only.
impl TryFrom<&Value> for BigDecimal
big-decimal only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &Value) -> ValueResult<BigDecimal>
fn try_from(value: &Value) -> ValueResult<BigDecimal>
Source§impl TryFrom<&Value> for String
impl TryFrom<&Value> for String
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for NaiveDate
Available on crate feature chrono only.
impl TryFrom<&Value> for NaiveDate
chrono only.Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for NaiveTime
Available on crate feature chrono only.
impl TryFrom<&Value> for NaiveTime
chrono only.Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for NaiveDateTime
Available on crate feature chrono only.
impl TryFrom<&Value> for NaiveDateTime
chrono only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: &Value) -> ValueResult<NaiveDateTime>
fn try_from(value: &Value) -> ValueResult<NaiveDateTime>
Source§impl TryFrom<&Value> for Duration
impl TryFrom<&Value> for Duration
Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for Url
Available on crate feature url only.
impl TryFrom<&Value> for Url
url only.Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<&Value> for Value
Available on crate feature json only.
impl TryFrom<&Value> for Value
json only.Source§type Error = ValueError
type Error = ValueError
Source§impl TryFrom<Value> for bool
impl TryFrom<Value> for bool
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for char
impl TryFrom<Value> for char
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for i8
impl TryFrom<Value> for i8
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for i16
impl TryFrom<Value> for i16
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for i32
impl TryFrom<Value> for i32
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for i64
impl TryFrom<Value> for i64
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for i128
impl TryFrom<Value> for i128
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for u8
impl TryFrom<Value> for u8
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for u16
impl TryFrom<Value> for u16
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for u32
impl TryFrom<Value> for u32
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for u64
impl TryFrom<Value> for u64
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for u128
impl TryFrom<Value> for u128
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for f32
impl TryFrom<Value> for f32
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for f64
impl TryFrom<Value> for f64
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for BigInt
Available on crate feature big-integer only.
impl TryFrom<Value> for BigInt
big-integer only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for BigDecimal
Available on crate feature big-decimal only.
impl TryFrom<Value> for BigDecimal
big-decimal only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for String
impl TryFrom<Value> for String
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for NaiveDate
Available on crate feature chrono only.
impl TryFrom<Value> for NaiveDate
chrono only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for NaiveTime
Available on crate feature chrono only.
impl TryFrom<Value> for NaiveTime
chrono only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for NaiveDateTime
Available on crate feature chrono only.
impl TryFrom<Value> for NaiveDateTime
chrono only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for DateTime<Utc>
Available on crate feature chrono only.
impl TryFrom<Value> for DateTime<Utc>
chrono only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for Duration
impl TryFrom<Value> for Duration
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for Url
Available on crate feature url only.
impl TryFrom<Value> for Url
url only.Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for HashMap<String, String>
impl TryFrom<Value> for HashMap<String, String>
Source§type Error = ValueError
type Error = ValueError
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Source§impl TryFrom<Value> for Value
Available on crate feature json only.
impl TryFrom<Value> for Value
json only.