pub trait Value:
Debug
+ Clone
+ Sized {
type Error: Error;
type MapType: Map<Value = Self>;
// Required methods
fn type_name(&self) -> &'static str;
fn as_null(&self) -> Result<(), ValueError>;
fn as_bool(&self) -> Result<bool, ValueError>;
fn as_uint(&self) -> Result<u64, ValueError>;
fn as_int(&self) -> Result<i64, ValueError>;
fn as_float(&self) -> Result<f64, ValueError>;
fn as_string(&self) -> Result<&str, ValueError>;
fn as_array(&self) -> Result<&[Self], ValueError>;
fn as_map(&self) -> Result<&Self::MapType, ValueError>;
fn from_string(source: &str) -> Result<Self, Self::Error>;
}
Required Associated Types§
Required Methods§
fn type_name(&self) -> &'static str
fn as_null(&self) -> Result<(), ValueError>
fn as_bool(&self) -> Result<bool, ValueError>
fn as_uint(&self) -> Result<u64, ValueError>
fn as_int(&self) -> Result<i64, ValueError>
fn as_float(&self) -> Result<f64, ValueError>
fn as_string(&self) -> Result<&str, ValueError>
fn as_array(&self) -> Result<&[Self], ValueError>
fn as_map(&self) -> Result<&Self::MapType, ValueError>
fn from_string(source: &str) -> Result<Self, Self::Error>
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.