pub trait TryFromValueCoerce: Sized {
// Required method
fn try_from_value_coerce(value: &Value) -> Result<Self, FromValueError>;
// Provided method
fn from_value_coerce(value: &Value) -> Option<Self> { ... }
}Expand description
Trait for widening extraction of Rust types from Value.
Unlike TryFromValue, this allows compatible type conversions:
i64can be extracted fromInt1,Int2,Int4, orInt8u64can be extracted fromUint1,Uint2,Uint4, orUint8f64can be extracted fromFloat4,Float8, or any integer type
Required Methods§
Sourcefn try_from_value_coerce(value: &Value) -> Result<Self, FromValueError>
fn try_from_value_coerce(value: &Value) -> Result<Self, FromValueError>
Attempt to extract with widening conversion.
Provided Methods§
Sourcefn from_value_coerce(value: &Value) -> Option<Self>
fn from_value_coerce(value: &Value) -> Option<Self>
Extract with coercion, returning None for Undefined or incompatible types.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.