Skip to main content

Value

Struct Value 

Source
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

Source

pub const fn Unset(data_type: DataType) -> Self

Creates an unset value with an explicit declared type.

§Parameters
  • data_type - Runtime type retained while the value is unset.
§Returns

An unset scalar retaining data_type.

Source

pub const fn new_unset(data_type: DataType) -> Self

Creates an unset value with an explicit declared type.

§Parameters
  • data_type - Runtime type retained while the value is unset.
§Returns

An unset scalar retaining data_type.

Source

pub fn Bool(value: bool) -> Self

Creates a Boolean value.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn Char(value: char) -> Self

Creates a Character value.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn Int8(value: i8) -> Self

Creates a 8-bit signed integer.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn Int16(value: i16) -> Self

Creates a 16-bit signed integer.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn Int32(value: i32) -> Self

Creates a 32-bit signed integer.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn Int64(value: i64) -> Self

Creates a 64-bit signed integer.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn Int128(value: i128) -> Self

Creates a 128-bit signed integer.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn UInt8(value: u8) -> Self

Creates a 8-bit unsigned integer.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn UInt16(value: u16) -> Self

Creates a 16-bit unsigned integer.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn UInt32(value: u32) -> Self

Creates a 32-bit unsigned integer.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn UInt64(value: u64) -> Self

Creates a 64-bit unsigned integer.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn UInt128(value: u128) -> Self

Creates a 128-bit unsigned integer.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn Float32(value: f32) -> Self

Creates a 32-bit floating-point number.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn Float64(value: f64) -> Self

Creates a 64-bit floating-point number.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn BigInteger(value: BigInt) -> Self

Available on crate feature big-integer only.

Creates a Arbitrary-precision integer.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn BigDecimal(value: BigDecimal) -> Self

Available on crate feature big-decimal only.

Creates a Arbitrary-precision decimal.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn String(value: String) -> Self

Creates a String value.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn Date(value: NaiveDate) -> Self

Available on crate feature chrono only.

Creates a Calendar date.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn Time(value: NaiveTime) -> Self

Available on crate feature chrono only.

Creates a Time of day.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn DateTime(value: NaiveDateTime) -> Self

Available on crate feature chrono only.

Creates a Date and time.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn Instant(value: DateTime<Utc>) -> Self

Available on crate feature chrono only.

Creates a UTC instant.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn Duration(value: Duration) -> Self

Creates a Duration.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn Url(value: Url) -> Self

Available on crate feature url only.

Creates a URL.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn StringMap(value: HashMap<String, String>) -> Self

Creates a Map with string keys and values.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source

pub fn Json(value: Value) -> Self

Available on crate feature json only.

Creates a JSON value.

§Parameters
  • value - Concrete payload stored by the returned scalar.
§Returns

A typed scalar containing value.

Source§

impl Value

Source

pub fn get_ref<'a, T: ?Sized>(&'a self) -> ValueResult<&'a T>
where &'a T: TryFrom<&'a Self, Error = ValueError>,

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.

Source

pub fn view(&self) -> ValueRef<'_>

Borrows the stable semantic view of this value.

§Returns

A non-owning view that hides private storage representation details.

Source

pub fn hash_with_json_budget<H, R, Q>( &self, state: &mut H, budget: &mut JsonValueBudget<R, Q>, ) -> Result<(), MeasuredBudgetError<R, Q>>
where H: Hasher, R: Clone, Q: ResourceQuantity,

Available on crate feature 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 as Hash::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

Source

pub fn new<T>(value: T) -> Self
where 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:

  • bool
  • char
  • i8, i16, i32, i64, i128
  • u8, u16, u32, u64, u128
  • f32, f64
  • String, &str
  • NaiveDate, NaiveTime, NaiveDateTime, DateTime<Utc>
  • BigInt, BigDecimal
  • Duration
  • Url
  • HashMap<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");
Source

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:

  • bool
  • char
  • i8, i16, i32, i64, i128
  • u8, u16, u32, u64, u128
  • f32, f64
  • String
  • NaiveDate, NaiveTime, NaiveDateTime, DateTime<Utc>
  • BigInt, BigDecimal
  • Duration
  • Url
  • HashMap<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);
Source

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 when self is unset.
§Returns

The stored value, or default when the value is unset.

§Errors

Returns ValueError::TypeMismatch when the stored type differs from T.

Source

pub fn get_or_else<T, F>(&self, default: F) -> ValueResult<T>
where for<'a> T: TryFrom<&'a Self, Error = ValueError>, F: FnOnce() -> 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 producing T.
§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.

Source

pub fn to<T>(&self) -> ValueResult<T>

Available on crate feature 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");
Source

pub fn to_or<T>(&self, default: impl IntoValueDefault<T>) -> ValueResult<T>

Available on crate feature 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.

Source

pub fn to_or_else<T, F>(&self, default: F) -> ValueResult<T>
where T: DataConversionTarget, F: FnOnce() -> T,

Available on crate feature 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 producing T.
§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.

Source

pub fn to_with<T>( &self, policy: &ConversionPolicy, limits: &ConversionLimits, ) -> ValueResult<T>

Available on crate feature 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.

Source

pub fn to_in<T>(&self, session: &mut ConversionSession<'_>) -> ValueResult<T>

Available on crate feature 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.

Source

pub fn to_or_with<T>( &self, default: impl IntoValueDefault<T>, policy: &ConversionPolicy, limits: &ConversionLimits, ) -> ValueResult<T>

Available on crate feature 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.

Source

pub 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.

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 producing T.
§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.

Source

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();
Source

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());
Source

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.

Source

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:

  • bool
  • char
  • i8, i16, i32, i64, i128
  • u8, u16, u32, u64, u128
  • f32, f64
  • String, &str
  • NaiveDate, NaiveTime, NaiveDateTime, DateTime<Utc>
  • BigInt, BigDecimal
  • Duration
  • Url
  • HashMap<String, String>
  • serde_json::Value
§Type Parameters
  • T - Input type convertible into Value.
§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");
Source

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

pub fn unset(&mut self)

Removes the concrete value while preserving its declared data type.

Source§

impl Value

Source

pub fn to_json_value(&self) -> ValueResult<JsonValue>

Available on crate features 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.

Source

pub fn to_json_value_with( &self, policy: &ConversionPolicy, limits: &ConversionLimits, ) -> ValueResult<JsonValue>

Available on crate features 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

Source

pub fn from_json_value(json: JsonValue) -> Self

Available on crate feature json only.

Creates a Value from a serde_json::Value.

§Parameters
  • json - The JSON value to wrap.
§Returns

A Value::Json wrapping the given JSON value.

Source

pub fn from_serializable<T: ?Sized + Serialize>(value: &T) -> ValueResult<Self>

Available on crate features converter and json only.

Creates a Value from any serializable value by converting it to JSON.

§Type Parameters
  • T - Any type implementing Serialize.
§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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn get_date(&self) -> ValueResult<NaiveDate>

Available on crate feature 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.

Source

pub fn get_time(&self) -> ValueResult<NaiveTime>

Available on crate feature 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.

Source

pub fn get_datetime(&self) -> ValueResult<NaiveDateTime>

Available on crate feature 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.

Source

pub fn get_instant(&self) -> ValueResult<DateTime<Utc>>

Available on crate feature 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.

Source

pub fn get_biginteger(&self) -> ValueResult<BigInt>

Available on crate feature 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.

Source

pub fn get_bigdecimal(&self) -> ValueResult<BigDecimal>

Available on crate feature 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.

Source

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.

Source

pub fn get_url(&self) -> ValueResult<Url>

Available on crate feature 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.

Source

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.

Source

pub fn get_json(&self) -> ValueResult<JsonValue>

Available on crate feature 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.

Source

pub fn get_biginteger_ref(&self) -> ValueResult<&BigInt>

Available on crate feature 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.

Source

pub fn get_bigdecimal_ref(&self) -> ValueResult<&BigDecimal>

Available on crate feature 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.

Source

pub fn get_url_ref(&self) -> ValueResult<&Url>

Available on crate feature 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.

Source

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.

Source

pub fn get_json_ref(&self) -> ValueResult<&JsonValue>

Available on crate feature 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.

Source

pub fn deserialize_json<T: DeserializeOwned>(&self) -> ValueResult<T>

Available on crate features 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 implementing DeserializeOwned.
§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

Source

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.

Source

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§

Source§

impl Clone for Value

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Value

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the borrowed semantic view without cloning owned payloads.

§Parameters
  • formatter - Destination and formatting options for the debug view.
§Returns

Ok(()) after the semantic view has been written.

§Errors

Returns the formatter’s error if writing the semantic view fails.

Source§

impl Eq for Value

Source§

impl<'a> From<&'a Value> for DataConverter<'a>

Available on crate feature converter only.
Source§

fn from(value: &'a Value) -> Self

Borrows a runtime value as a shared conversion source.

§Parameters
  • value - Runtime value whose storage is exposed to the converter.
§Returns

A DataConverter borrowing rich payloads from value without cloning them.

Source§

impl From<&str> for Value

Source§

fn from(value: &str) -> Self

Copies borrowed UTF-8 text into an owned string value.

The returned container is independent of the input string’s lifetime.

§Parameters
  • value - Text copied into the container’s string storage.
§Returns

A string value owning a copy of value.

Source§

impl From<BigDecimal> for Value

Available on crate feature big-decimal only.
Source§

fn from(value: BigDecimal) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<BigInt> for Value

Available on crate feature big-integer only.
Source§

fn from(value: BigInt) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<DateTime<Utc>> for Value

Available on crate feature chrono only.
Source§

fn from(value: DateTime<Utc>) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<Duration> for Value

Source§

fn from(value: Duration) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<HashMap<String, String>> for Value

Source§

fn from(value: HashMap<String, String>) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<NaiveDate> for Value

Available on crate feature chrono only.
Source§

fn from(value: NaiveDate) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<NaiveDateTime> for Value

Available on crate feature chrono only.
Source§

fn from(value: NaiveDateTime) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<NaiveTime> for Value

Available on crate feature chrono only.
Source§

fn from(value: NaiveTime) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<String> for Value

Source§

fn from(value: String) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<Url> for Value

Available on crate feature url only.
Source§

fn from(value: Url) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<Value> for MultiValues

Source§

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 Value

Available on crate feature json only.
Source§

fn from(value: Value) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<Value> for ValueContainer

Source§

fn from(value: Value) -> Self

Wraps the value as a scalar without cloning it.

§Parameters
  • value - Input converted with the ownership behavior described above.
§Returns

A container preserving the input data type and scalar or collection shape.

Source§

impl From<bool> for Value

Source§

fn from(value: bool) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<char> for Value

Source§

fn from(value: char) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<f32> for Value

Source§

fn from(value: f32) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<f64> for Value

Source§

fn from(value: f64) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<i8> for Value

Source§

fn from(value: i8) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<i16> for Value

Source§

fn from(value: i16) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<i32> for Value

Source§

fn from(value: i32) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<i64> for Value

Source§

fn from(value: i64) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<i128> for Value

Source§

fn from(value: i128) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<u8> for Value

Source§

fn from(value: u8) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<u16> for Value

Source§

fn from(value: u16) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<u32> for Value

Source§

fn from(value: u32) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<u64> for Value

Source§

fn from(value: u64) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl From<u128> for Value

Source§

fn from(value: u128) -> Self

Wraps an owned payload in its matching runtime value type.

§Parameters
  • value - Payload moved into the returned container without cloning.
§Returns

A typed value owning the supplied payload.

Source§

impl Hash for Value

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Hashes the variant and payload consistently with equality.

§Type Parameters
  • H: Hasher receiving the semantic identity.
§Parameters
  • state: Hasher updated without cloning or consuming the value.
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Value

Source§

fn eq(&self, other: &Self) -> bool

Compares variant identity and semantic payload identity.

§Parameters
  • other: Value borrowed for comparison without consuming it.
§Returns

Whether both values have the same variant and equal payloads, with floating-point NaNs and signed zero canonicalized.

1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Redact for Value

Available on crate feature redact only.
Source§

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

Source§

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>

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

Source§

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>

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

Source§

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>

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

Source§

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>

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

Source§

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>

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

Source§

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>

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

Source§

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>

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

Source§

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>

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

Source§

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>

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

Source§

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>

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

Source§

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>

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

Source§

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>

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

Source§

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>

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

Source§

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>

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.
Source§

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>

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.
Source§

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>

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

Source§

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>

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.
Source§

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>

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.
Source§

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>

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.
Source§

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>

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.
Source§

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>

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

Source§

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>

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.
Source§

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>

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>

Source§

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>

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.
Source§

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>

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

Source§

type Error = ValueError

Reports an unset string value or a runtime type mismatch.

Source§

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>

Source§

type Error = ValueWireEncodeError

V1 representation validation failure; the borrowed input is unchanged.

Source§

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>

Source§

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>

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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.
Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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.
Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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.
Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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.
Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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.
Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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.
Source§

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>>

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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.
Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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>

Source§

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>>

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.
Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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.
Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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.
Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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.
Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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.
Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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.
Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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.
Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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.
Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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>

Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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.
Source§

type Error = ValueError

Reports an unset value of the requested type or a runtime type mismatch.

Source§

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

Source§

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>

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

Source§

type Error = ValueWireEncodeError

Failure to represent the consumed runtime value under the V1 contract.

Source§

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.

Auto Trait Implementations§

§

impl Forget for Value

§

impl Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnsafeUnpin for Value

§

impl UnwindSafe for Value

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoValueDefault<T> for T

Source§

fn into_value_default(self) -> T

Returns the owned value unchanged as the default.

§Returns

The input value, moved without cloning.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.