pub trait ToValue {
// Required method
fn to_value(self) -> Value;
}Expand description
Lossless conversion of validated schema outputs into Values.
Implemented for the realistic form-coercion targets; u64/usize are
deliberately excluded because they do not fit the I64 fidelity rules
(DV-1) without silent truncation.
The exclusion is enforced at compile time: coerced::<u64>() is a valid
standalone schema, but it cannot back an object field because the
crate::schema::ObjectChild impl requires T: ToValue.
ⓘ
use formars_core::prelude::*;
let _ = object().field("n", coerced::<u64>()); // u64 lacks ToValueRequired Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".