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.
§Equality and hashing
Equality includes the runtime variant, so values such as Int32(1) and
Int64(1) are distinct. An unset value’s declared type also participates in
its identity. Within each floating-point width, all NaN payloads compare
equal and positive and negative zero compare equal. String maps and JSON
objects compare and hash independently of entry order; JSON arrays preserve
element order. BigDecimal values use numeric equality, and their hashes use
the same normalized numeric identity. Use Value::numeric_cmp to compare
numeric values across runtime types; Eq does not provide cross-type
numeric comparison. Hash output is intended for in-process collections and
is not a persistent fingerprint.
§JSON nesting and lifecycle
With the json feature, JSON equality and hashing use iterative traversal.
This does not provide the same guarantee for the entire value lifecycle:
cloning, ordinary Debug formatting, and dropping JSON payloads still
follow recursive paths in the underlying serde_json::Value.
Very deeply nested trees may exhaust the thread stack during those
operations.
Keep untrusted JSON nesting bounded, and consider these lifecycle operations before raising decoder depth limits. Directly constructed in-memory JSON does not pass through those decoder limits. Borrowed reads avoid unnecessary clones but do not remove recursive destruction of the source value. There is no universal safe depth across platforms and thread configurations.
§Examples
use qubit_value::Value;
let value = Value::from(42_i32);
assert_eq!(value.get_int32().unwrap(), 42);Equality follows the runtime variant while normalizing NaN and signed zero within a floating-point width:
use qubit_value::Value;
assert_ne!(Value::Int32(1), Value::Int64(1));
assert_eq!(Value::Float64(f64::NAN), Value::Float64(f64::NAN));
assert_eq!(Value::Float64(0.0), Value::Float64(-0.0));Implementations§
Source§impl Value
impl Value
Sourcepub fn BigInteger(value: BigInt) -> Self
Available on crate feature big-integer only.
pub fn BigInteger(value: BigInt) -> Self
big-integer only.Sourcepub fn BigDecimal(value: BigDecimal) -> Self
Available on crate feature big-decimal only.
pub fn BigDecimal(value: BigDecimal) -> Self
big-decimal only.Sourcepub fn DateTime(value: NaiveDateTime) -> Self
Available on crate feature chrono only.
pub fn DateTime(value: NaiveDateTime) -> Self
chrono only.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.
The requested type must implement a reference conversion from Value;
this method does not perform cross-type conversion.
§Type Parameters
T- Expected scalar payload type.
§Returns
A shared reference to the stored payload when its type matches T.
§Errors
Returns ValueError::Missing when the value is unset for T, or
ValueError::TypeMismatch when its concrete type differs.
Sourcepub fn view(&self) -> ValueRef<'_>
pub fn view(&self) -> ValueRef<'_>
Borrows the stable semantic view of this value.
§Returns
A non-owning view that hides private storage representation details.
Sourcepub fn hash_with_json_budget<H, R, Q>(
&self,
state: &mut H,
budget: &mut JsonValueBudget<R, Q>,
) -> Result<(), MeasuredBudgetError<R, Q>>
Available on crate feature json only.
pub fn hash_with_json_budget<H, R, Q>( &self, state: &mut H, budget: &mut JsonValueBudget<R, Q>, ) -> Result<(), MeasuredBudgetError<R, Q>>
json only.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
impl Value
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,
Available on crate feature converter only.
pub fn to<T>(&self) -> ValueResult<T>where
T: DataConversionTarget,
converter only.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,
Available on crate feature converter only.
pub fn to_or<T>(&self, default: impl IntoValueDefault<T>) -> ValueResult<T>where
T: DataConversionTarget,
converter only.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,
Available on crate feature converter only.
pub fn to_or_else<T, F>(&self, default: F) -> ValueResult<T>where
T: DataConversionTarget,
F: FnOnce() -> T,
converter only.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,
Available on crate feature converter only.
pub fn to_with<T>(
&self,
policy: &ConversionPolicy,
limits: &ConversionLimits,
) -> ValueResult<T>where
T: DataConversionTarget,
converter only.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,
Available on crate feature converter only.
pub fn to_in<T>(&self, session: &mut ConversionSession<'_>) -> ValueResult<T>where
T: DataConversionTarget,
converter only.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,
Available on crate feature converter only.
pub fn to_or_with<T>(
&self,
default: impl IntoValueDefault<T>,
policy: &ConversionPolicy,
limits: &ConversionLimits,
) -> ValueResult<T>where
T: DataConversionTarget,
converter only.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,
Available on crate feature converter only.
pub fn to_or_else_with<T, F>(
&self,
default: F,
policy: &ConversionPolicy,
limits: &ConversionLimits,
) -> ValueResult<T>where
T: DataConversionTarget,
F: FnOnce() -> T,
converter only.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 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<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 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<JsonValue>
Available on crate features converter and json only.
pub fn to_json_value(&self) -> ValueResult<JsonValue>
converter and json only.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.
For natural JSON projection, max_text_bytes bounds each string value
and each formatted number or rich-value text by its UTF-8 byte length,
including strings inside materialized JSON. Object keys are excluded
from this per-item bound but still consume applicable key and
cumulative input, output, and payload budgets. This is neither a
cumulative text limit nor a limit on escaped JSON encoding size.
§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<JsonValue>
Available on crate features converter and json only.
pub fn to_json_value_with( &self, policy: &ConversionPolicy, limits: &ConversionLimits, ) -> ValueResult<JsonValue>
converter and json only.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 ValueError::JsonProjectionLimit when a projection resource
limit is exceeded, or a structured conversion error when JSON
projection or duration formatting violates the requested policy.
Source§impl Value
impl Value
Sourcepub fn from_json_value(json: JsonValue) -> Self
Available on crate feature json only.
pub fn from_json_value(json: JsonValue) -> Self
json only.Sourcepub fn from_serializable<T: ?Sized + Serialize>(value: &T) -> ValueResult<Self>
Available on crate features converter and json only.
pub fn from_serializable<T: ?Sized + Serialize>(value: &T) -> ValueResult<Self>
converter and json only.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 when serialization encounters a
non-finite nested float, an integer outside the strict JSON range, or
another unsupported Serde representation.
§Resource limits
This method validates the JSON representation but does not apply a
finite resource budget. JsonEncodeLimits and ConversionLimits do
not constrain this materialization; use JsonValueEncoder with a
caller-owned JsonValueBudget when a bounded projection is required.
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>
Available on crate feature chrono only.
pub fn get_date(&self) -> ValueResult<NaiveDate>
chrono only.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>
Available on crate feature chrono only.
pub fn get_time(&self) -> ValueResult<NaiveTime>
chrono only.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>
Available on crate feature chrono only.
pub fn get_datetime(&self) -> ValueResult<NaiveDateTime>
chrono only.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>>
Available on crate feature chrono only.
pub fn get_instant(&self) -> ValueResult<DateTime<Utc>>
chrono only.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>
Available on crate feature big-integer only.
pub fn get_biginteger(&self) -> ValueResult<BigInt>
big-integer only.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>
Available on crate feature big-decimal only.
pub fn get_bigdecimal(&self) -> ValueResult<BigDecimal>
big-decimal only.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>
Available on crate feature url only.
pub fn get_url(&self) -> ValueResult<Url>
url only.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<JsonValue>
Available on crate feature json only.
pub fn get_json(&self) -> ValueResult<JsonValue>
json only.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>
Available on crate feature big-integer only.
pub fn get_biginteger_ref(&self) -> ValueResult<&BigInt>
big-integer only.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>
Available on crate feature big-decimal only.
pub fn get_bigdecimal_ref(&self) -> ValueResult<&BigDecimal>
big-decimal only.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>
Available on crate feature url only.
pub fn get_url_ref(&self) -> ValueResult<&Url>
url only.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<&JsonValue>
Available on crate feature json only.
pub fn get_json_ref(&self) -> ValueResult<&JsonValue>
json only.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>
Available on crate features converter and json only.
pub fn deserialize_json<T: DeserializeOwned>(&self) -> ValueResult<T>
converter and json only.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.
§Resource limits
This method deserializes an already materialized JSON value. It does
not apply ConversionLimits, a ConversionSession, or a JSON decode
budget to target deserialization. Earlier bounded decoding does not
bound allocations, recursion, or custom Deserialize work performed
here. Keep input structure bounded and evaluate the target
deserializer’s resource behavior before using this method with
untrusted data.
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.
Conversion limits and session budgets do not apply to this independent comparison. Fixed-width comparisons do not require heap allocation; some paths involving large numbers may clone coefficients or construct exact rational or decimal values, with cost depending on the operand representations. Constrain untrusted coefficient sizes and scales at the input boundary, and consider cumulative cost in batch filters. See the lower-level comparison contract.
§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>
Available on crate feature converter only.
impl<'a> From<&'a Value> for DataConverter<'a>
converter only.Source§impl From<BigDecimal> for Value
Available on crate feature big-decimal only.
impl From<BigDecimal> for Value
big-decimal only.Source§impl From<NaiveDateTime> for Value
Available on crate feature chrono only.
impl From<NaiveDateTime> for Value
chrono only.Source§impl From<Value> for MultiValues
impl From<Value> for MultiValues
Source§fn from(value: Value) -> Self
fn from(value: Value) -> Self
Moves a scalar payload into a one-item collection, preserving its type.
An unset scalar becomes an unset collection with the same declared type.
§Parameters
value- Scalar whose owned storage is transferred to the collection.
§Returns
A one-item collection, or a typed unset collection for an unset scalar.
Source§impl From<Value> for ValueContainer
impl From<Value> for ValueContainer
Source§impl Redact for Value
Available on crate feature redact only.
impl Redact for Value
redact only.Source§fn write_redacted(&self, writer: &mut RedactionWriter<'_>)
fn write_redacted(&self, writer: &mut RedactionWriter<'_>)
Writes one value through the shared structured writer.
§Parameters
writer: Borrowed writer for the active redaction session; receives the classified representation without modifying the source value.
Source§impl<'a> TryFrom<&'a Value> for &'a bool
impl<'a> TryFrom<&'a Value> for &'a bool
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a char
impl<'a> TryFrom<&'a Value> for &'a char
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a i8
impl<'a> TryFrom<&'a Value> for &'a i8
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a i16
impl<'a> TryFrom<&'a Value> for &'a i16
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a i32
impl<'a> TryFrom<&'a Value> for &'a i32
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a i64
impl<'a> TryFrom<&'a Value> for &'a i64
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a i128
impl<'a> TryFrom<&'a Value> for &'a i128
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a u8
impl<'a> TryFrom<&'a Value> for &'a u8
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a u16
impl<'a> TryFrom<&'a Value> for &'a u16
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a u32
impl<'a> TryFrom<&'a Value> for &'a u32
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a u64
impl<'a> TryFrom<&'a Value> for &'a u64
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a u128
impl<'a> TryFrom<&'a Value> for &'a u128
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a f32
impl<'a> TryFrom<&'a Value> for &'a f32
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a f64
impl<'a> TryFrom<&'a Value> for &'a f64
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a String
impl<'a> TryFrom<&'a Value> for &'a String
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a Duration
impl<'a> TryFrom<&'a Value> for &'a Duration
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the matching payload without copying or allocating.
§Parameters
value- Container that owns the payload and must outlive the returned reference.
§Returns
A payload reference tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for &'a str
impl<'a> TryFrom<&'a Value> for &'a str
Source§type Error = ValueError
type Error = ValueError
Reports an unset string value or a runtime type mismatch.
Source§fn try_from(value: &'a Value) -> ValueResult<Self>
fn try_from(value: &'a Value) -> ValueResult<Self>
Borrows the stored string as a slice without copying or allocating.
§Parameters
value- Container that owns the string and must outlive the returned slice.
§Returns
A string slice tied to the lifetime of value.
§Errors
Returns ValueError::Missing for an unset string value, or
ValueError::TypeMismatch for any other runtime type.
Source§impl<'a> TryFrom<&'a Value> for ValueWirePayloadRefV1<'a>
impl<'a> TryFrom<&'a Value> for ValueWirePayloadRefV1<'a>
Source§type Error = ValueWireEncodeError
type Error = ValueWireEncodeError
V1 representation validation failure; the borrowed input is unchanged.
Source§fn try_from(value: &'a Value) -> Result<Self, Self::Error>
fn try_from(value: &'a Value) -> Result<Self, Self::Error>
Borrows and validates a scalar.
§Parameters
value- Scalar runtime value to validate and borrow.
§Returns
A validated V1 payload borrowing the original input without cloning.
§Errors
Returns the representation validation errors documented by
Self::from_value.
Source§impl<'a> TryFrom<&'a Value> for ValueWireRefV1<'a>
impl<'a> TryFrom<&'a Value> for ValueWireRefV1<'a>
Source§type Error = ValueWireEncodeError
type Error = ValueWireEncodeError
Validation failure when the borrowed input cannot be represented in V1.
Source§fn try_from(value: &'a Value) -> Result<Self, Self::Error>
fn try_from(value: &'a Value) -> Result<Self, Self::Error>
Validates and borrows the input without cloning its payload.
§Parameters
value- Scalar runtime value to validate and borrow for'a.
§Returns
A borrowed V1 envelope preserving the input shape.
§Errors
Returns the same representational validation errors as
Self::from_value.
Source§impl TryFrom<&Value> for bool
impl TryFrom<&Value> for bool
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<bool>
fn try_from(value: &Value) -> ValueResult<bool>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for char
impl TryFrom<&Value> for char
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<char>
fn try_from(value: &Value) -> ValueResult<char>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for i8
impl TryFrom<&Value> for i8
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<i8>
fn try_from(value: &Value) -> ValueResult<i8>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for i16
impl TryFrom<&Value> for i16
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<i16>
fn try_from(value: &Value) -> ValueResult<i16>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for i32
impl TryFrom<&Value> for i32
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<i32>
fn try_from(value: &Value) -> ValueResult<i32>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for i64
impl TryFrom<&Value> for i64
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<i64>
fn try_from(value: &Value) -> ValueResult<i64>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for i128
impl TryFrom<&Value> for i128
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<i128>
fn try_from(value: &Value) -> ValueResult<i128>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for u8
impl TryFrom<&Value> for u8
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<u8>
fn try_from(value: &Value) -> ValueResult<u8>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for u16
impl TryFrom<&Value> for u16
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<u16>
fn try_from(value: &Value) -> ValueResult<u16>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for u32
impl TryFrom<&Value> for u32
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<u32>
fn try_from(value: &Value) -> ValueResult<u32>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for u64
impl TryFrom<&Value> for u64
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<u64>
fn try_from(value: &Value) -> ValueResult<u64>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for u128
impl TryFrom<&Value> for u128
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<u128>
fn try_from(value: &Value) -> ValueResult<u128>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for f32
impl TryFrom<&Value> for f32
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<f32>
fn try_from(value: &Value) -> ValueResult<f32>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for f64
impl TryFrom<&Value> for f64
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<f64>
fn try_from(value: &Value) -> ValueResult<f64>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<BigInt>
fn try_from(value: &Value) -> ValueResult<BigInt>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<BigDecimal>
fn try_from(value: &Value) -> ValueResult<BigDecimal>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for String
impl TryFrom<&Value> for String
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<String>
fn try_from(value: &Value) -> ValueResult<String>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<NaiveDate>
fn try_from(value: &Value) -> ValueResult<NaiveDate>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<NaiveTime>
fn try_from(value: &Value) -> ValueResult<NaiveTime>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<NaiveDateTime>
fn try_from(value: &Value) -> ValueResult<NaiveDateTime>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<DateTime<Utc>>
fn try_from(value: &Value) -> ValueResult<DateTime<Utc>>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for Duration
impl TryFrom<&Value> for Duration
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<Duration>
fn try_from(value: &Value) -> ValueResult<Duration>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<Url>
fn try_from(value: &Value) -> ValueResult<Url>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<&Value> for HashMap<String, String>
impl TryFrom<&Value> for HashMap<String, String>
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<HashMap<String, String>>
fn try_from(value: &Value) -> ValueResult<HashMap<String, String>>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: &Value) -> ValueResult<Value>
fn try_from(value: &Value) -> ValueResult<Value>
Copies or clones the matching payload without changing the container.
§Parameters
value- Container borrowed for the duration of this read.
§Returns
An owned payload; heap-backed payloads are cloned.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for bool
impl TryFrom<Value> for bool
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for char
impl TryFrom<Value> for char
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for i8
impl TryFrom<Value> for i8
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for i16
impl TryFrom<Value> for i16
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for i32
impl TryFrom<Value> for i32
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for i64
impl TryFrom<Value> for i64
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for i128
impl TryFrom<Value> for i128
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for u8
impl TryFrom<Value> for u8
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for u16
impl TryFrom<Value> for u16
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for u32
impl TryFrom<Value> for u32
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for u64
impl TryFrom<Value> for u64
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for u128
impl TryFrom<Value> for u128
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for f32
impl TryFrom<Value> for f32
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for f64
impl TryFrom<Value> for f64
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for String
impl TryFrom<Value> for String
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for Duration
impl TryFrom<Value> for Duration
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for HashMap<String, String>
impl TryFrom<Value> for HashMap<String, String>
Source§type Error = ValueError
type Error = ValueError
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
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
Reports an unset value of the requested type or a runtime type mismatch.
Source§fn try_from(value: Value) -> ValueResult<Self>
fn try_from(value: Value) -> ValueResult<Self>
Consumes the container and moves out its matching payload without cloning.
§Parameters
value- Container consumed even when its runtime type does not match.
§Returns
The owned payload moved from the container.
§Errors
Returns ValueError::Missing for an unset value of the requested
type, or ValueError::TypeMismatch for any other runtime type.
Source§impl TryFrom<Value> for ValueWirePayloadV1
impl TryFrom<Value> for ValueWirePayloadV1
Source§type Error = ValueWireEncodeError
type Error = ValueWireEncodeError
Validation failure when the runtime value cannot satisfy the V1 wire contract.
Source§fn try_from(value: Value) -> Result<Self, Self::Error>
fn try_from(value: Value) -> Result<Self, Self::Error>
Validates a scalar for use in a V1 payload.
§Parameters
value- Scalar to validate and take ownership of.
§Returns
A validated owned unversioned V1 payload.
§Errors
Returns ValueWireEncodeError::NonFiniteFloat for a non-finite
float, ValueWireEncodeError::BigDecimalScaleTooLarge for a decimal
whose exponent is outside V1’s supported range, or
ValueWireEncodeError::InstantYearOutOfRange for an instant outside
the supported UTC year range.
With the json feature, returns JsonNumberNotRoundTrippable if a
runtime JSON number, including a nested number, cannot preserve its
serde_json::Number identity under the V1 number model.
Source§impl TryFrom<Value> for ValueWireV1
impl TryFrom<Value> for ValueWireV1
Source§type Error = ValueWireEncodeError
type Error = ValueWireEncodeError
Failure to represent the consumed runtime value under the V1 contract.
Source§fn try_from(value: Value) -> Result<Self, Self::Error>
fn try_from(value: Value) -> Result<Self, Self::Error>
Wraps a runtime scalar in a V1 DTO.
§Parameters
value- Runtime scalar to validate and consume.
§Returns
A V1 DTO preserving the input type and shape.
§Errors
Returns ValueWireEncodeError::NonFiniteFloat for a non-finite
float, ValueWireEncodeError::BigDecimalScaleTooLarge for a decimal
whose exponent is outside V1’s supported range, or
ValueWireEncodeError::InstantYearOutOfRange for an instant outside
the supported UTC year range.
With the json feature, returns JsonNumberNotRoundTrippable if a
runtime JSON number, including a nested number, cannot preserve its
serde_json::Number identity under the V1 number model.