Skip to main content

StrictValueRead

Trait StrictValueRead 

Source
pub trait StrictValueRead: Sized + Sealed { }
Expand description

Marks target types supported by exact, non-converting reads.

This trait is sealed because supported types are determined by the closed runtime qubit_datatype::DataType family. Domain conversions belong in explicit conversion boundaries, rather than changing strict-read semantics.

§Examples

use qubit_value::{StrictValueRead, Value, ValueResult};

fn read_exact<T: StrictValueRead>(value: &Value) -> ValueResult<T> {
    T::read_scalar(value)
}

assert_eq!(read_exact::<i32>(&Value::from(42_i32)).unwrap(), 42);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> StrictValueRead for T
where for<'a> T: TryFrom<&'a Value, Error = ValueError> + TryFrom<&'a MultiValues, Error = ValueError>, for<'a> Vec<T>: TryFrom<&'a MultiValues, Error = ValueError>,