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.

§Examples

use qubit_value::Value;

let value = Value::from(42_i32);
assert_eq!(value.get_int32().unwrap(), 42);

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

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

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

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

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

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

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

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

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.

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,

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

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§

impl Value

Unified getter generation macro

Supports two modes:

  1. copy: - For types implementing the Copy trait, directly returns the value
  2. ref: - For non-Copy types, returns a reference

§Documentation Comment Support

The macro automatically extracts preceding documentation comments, so you can add /// comments before macro invocations.

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>

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>

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,

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>

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>

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>

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,

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 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 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 unset(&mut self)

Removes the concrete value while preserving its declared data type.

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§

impl Value

Source

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

Projects this typed value to its natural JSON representation.

This differs from the tagged crate::ValueWireV1 representation: for example, Value::Int32(42) projects to the JSON number 42.

§Returns

The natural JSON representation of this value.

§Errors

Returns a structured conversion error for values JSON cannot represent, including non-finite floating-point values and inexact durations.

Source

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

Projects this typed value using explicit conversion policy and limits.

§Parameters
  • policy - Controls duration units and precision-loss behavior.
  • limits - Bounds conversion resource consumption.
§Returns

The natural JSON representation of this value.

§Errors

Returns a structured conversion error when JSON projection or duration formatting violates the requested policy or limits.

Source§

impl Value

Source

pub fn from_json_value(json: Value) -> Self

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>

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 with A non-finite reason is returned when any nested float is non-finite, an out-of-range reason when an integer exceeds the strict JSON range, or a serialization reason for every other unsupported Serde representation.

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>

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>

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>

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

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>

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>

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>

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

Get JSON value.

This method returns a cloned serde_json::Value. Use Value::get_json_ref to borrow the stored value without cloning.

§Returns

If types match, returns the JSON value; see # Errors.

§Errors

Returns ValueError::Missing when the value is unset with the requested type, or ValueError::TypeMismatch when the stored data type differs.

Source

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

Borrow the inner BigInt without cloning.

§Returns

A shared reference to the stored integer.

§Errors

Returns ValueError::Missing when the value is unset with DataType::BigInteger, or ValueError::TypeMismatch when the stored data type differs.

Source

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

Borrow the inner BigDecimal without cloning.

§Returns

A shared reference to the stored decimal.

§Errors

Returns ValueError::Missing when the value is unset with DataType::BigDecimal, or ValueError::TypeMismatch when the stored data type differs.

Source

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

Borrow the inner Url without cloning.

§Returns

A shared reference to the stored URL.

§Errors

Returns ValueError::Missing when the value is unset with DataType::Url, or ValueError::TypeMismatch when the stored data type differs.

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

Borrow the inner JSON value without cloning.

§Returns

A shared reference to the stored JSON value.

§Errors

Returns ValueError::Missing when the value is unset with DataType::Json, or ValueError::TypeMismatch when the stored data type differs.

Source

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

Deserialize the inner JSON value into a target type.

Only works when self is Value::Json(...).

§Type Parameters
  • T - The target type 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.

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.

§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) -> Value

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 value using the given formatter. Read more
Source§

impl Eq for Value

Source§

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

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

Converts to this type from the input type.
Source§

impl From<BigDecimal> for Value

Available on crate feature big-decimal only.
Source§

fn from(value: BigDecimal) -> Self

Converts to this type from the input type.
Source§

impl From<BigInt> for Value

Available on crate feature big-integer only.
Source§

fn from(value: BigInt) -> Self

Converts to this type from the input type.
Source§

impl From<DateTime<Utc>> for Value

Available on crate feature chrono only.
Source§

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

Converts to this type from the input type.
Source§

impl From<Duration> for Value

Source§

fn from(value: Duration) -> Self

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl From<NaiveDate> for Value

Available on crate feature chrono only.
Source§

fn from(value: NaiveDate) -> Self

Converts to this type from the input type.
Source§

impl From<NaiveDateTime> for Value

Available on crate feature chrono only.
Source§

fn from(value: NaiveDateTime) -> Self

Converts to this type from the input type.
Source§

impl From<NaiveTime> for Value

Available on crate feature chrono only.
Source§

fn from(value: NaiveTime) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Value

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl From<Url> for Value

Available on crate feature url only.
Source§

fn from(value: Url) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for MultiValues

Source§

fn from(value: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for Value

Available on crate feature json only.
Source§

fn from(value: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for ValueContainer

Source§

fn from(value: Value) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for Value

Source§

fn from(value: bool) -> Self

Converts to this type from the input type.
Source§

impl From<char> for Value

Source§

fn from(value: char) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for Value

Source§

fn from(value: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Value

Source§

fn from(value: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Value

Source§

fn from(value: i8) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Value

Source§

fn from(value: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Value

Source§

fn from(value: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Value

Source§

fn from(value: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for Value

Source§

fn from(value: i128) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Value

Source§

fn from(value: u8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Value

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Value

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Value

Source§

fn from(value: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for Value

Source§

fn from(value: u128) -> Self

Converts to this type from the input type.
Source§

impl Hash for Value

Source§

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

Feeds this value into the given Hasher. Read more
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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Redact for Value

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Writes one value through the shared structured writer.

Source§

impl<'a> TryFrom<&'a Value> for &'a bool

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a char

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a i8

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a i16

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a i32

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a i64

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a i128

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a u8

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a u16

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a u32

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a u64

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a u128

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a f32

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a f64

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a BigInt

Available on crate feature big-integer only.
Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a BigDecimal

Available on crate feature big-decimal only.
Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a String

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a NaiveDate

Available on crate feature chrono only.
Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a NaiveTime

Available on crate feature chrono only.
Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a NaiveDateTime

Available on crate feature chrono only.
Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a DateTime<Utc>

Available on crate feature chrono only.
Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a Duration

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a Url

Available on crate feature url only.
Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a HashMap<String, String>

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a Value

Available on crate feature json only.
Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a str

Source§

type Error = ValueError

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

fn try_from(value: &'a Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for ValueWirePayloadRefV1<'a>

Source§

fn try_from(value: &'a Value) -> Result<Self, Self::Error>

Borrows and validates a scalar.

Source§

type Error = ValueWireEncodeError

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

impl<'a> TryFrom<&'a Value> for ValueWireRefV1<'a>

Source§

fn try_from(value: &'a Value) -> Result<Self, Self::Error>

Borrows and validates a scalar.

Source§

type Error = ValueWireEncodeError

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

impl TryFrom<&Value> for bool

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<bool>

Performs the conversion.
Source§

impl TryFrom<&Value> for char

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<char>

Performs the conversion.
Source§

impl TryFrom<&Value> for i8

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<i8>

Performs the conversion.
Source§

impl TryFrom<&Value> for i16

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<i16>

Performs the conversion.
Source§

impl TryFrom<&Value> for i32

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<i32>

Performs the conversion.
Source§

impl TryFrom<&Value> for i64

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<i64>

Performs the conversion.
Source§

impl TryFrom<&Value> for i128

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<i128>

Performs the conversion.
Source§

impl TryFrom<&Value> for u8

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<u8>

Performs the conversion.
Source§

impl TryFrom<&Value> for u16

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<u16>

Performs the conversion.
Source§

impl TryFrom<&Value> for u32

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<u32>

Performs the conversion.
Source§

impl TryFrom<&Value> for u64

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<u64>

Performs the conversion.
Source§

impl TryFrom<&Value> for u128

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<u128>

Performs the conversion.
Source§

impl TryFrom<&Value> for f32

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<f32>

Performs the conversion.
Source§

impl TryFrom<&Value> for f64

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<f64>

Performs the conversion.
Source§

impl TryFrom<&Value> for BigInt

Available on crate feature big-integer only.
Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<BigInt>

Performs the conversion.
Source§

impl TryFrom<&Value> for BigDecimal

Available on crate feature big-decimal only.
Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<BigDecimal>

Performs the conversion.
Source§

impl TryFrom<&Value> for String

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<String>

Performs the conversion.
Source§

impl TryFrom<&Value> for NaiveDate

Available on crate feature chrono only.
Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<NaiveDate>

Performs the conversion.
Source§

impl TryFrom<&Value> for NaiveTime

Available on crate feature chrono only.
Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<NaiveTime>

Performs the conversion.
Source§

impl TryFrom<&Value> for NaiveDateTime

Available on crate feature chrono only.
Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<NaiveDateTime>

Performs the conversion.
Source§

impl TryFrom<&Value> for DateTime<Utc>

Available on crate feature chrono only.
Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<DateTime<Utc>>

Performs the conversion.
Source§

impl TryFrom<&Value> for Duration

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<Duration>

Performs the conversion.
Source§

impl TryFrom<&Value> for Url

Available on crate feature url only.
Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<Url>

Performs the conversion.
Source§

impl TryFrom<&Value> for HashMap<String, String>

Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<HashMap<String, String>>

Performs the conversion.
Source§

impl TryFrom<&Value> for Value

Available on crate feature json only.
Source§

type Error = ValueError

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

fn try_from(value: &Value) -> ValueResult<Value>

Performs the conversion.
Source§

impl TryFrom<Value> for bool

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for char

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for i8

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for i16

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for i32

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for i64

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for i128

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for u8

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for u16

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for u32

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for u64

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for u128

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for f32

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for f64

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for BigInt

Available on crate feature big-integer only.
Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for BigDecimal

Available on crate feature big-decimal only.
Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for String

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for NaiveDate

Available on crate feature chrono only.
Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for NaiveTime

Available on crate feature chrono only.
Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for NaiveDateTime

Available on crate feature chrono only.
Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for DateTime<Utc>

Available on crate feature chrono only.
Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for Duration

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for Url

Available on crate feature url only.
Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

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

Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for Value

Available on crate feature json only.
Source§

type Error = ValueError

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

fn try_from(value: Value) -> ValueResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for ValueWirePayloadV1

Source§

fn try_from(value: Value) -> Result<Self, Self::Error>

Validates a scalar for use in a V1 payload.

Source§

type Error = ValueWireEncodeError

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

impl TryFrom<Value> for ValueWireV1

Source§

fn try_from(value: Value) -> Result<Self, Self::Error>

Wraps a runtime scalar in a V1 DTO.

Source§

type Error = ValueWireEncodeError

The type returned in the event of a conversion error.

Auto Trait Implementations§

§

impl Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnsafeUnpin for Value

§

impl UnwindSafe for Value

Blanket Implementations§

Source§

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

Converts this argument into the default value. Read more
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.