pub trait TryFromJsonObject: Sized {
type Error;
// Required method
fn try_from_json_object_at(
object: &Object,
code_map: &CodeMap,
offset: usize,
) -> Result<Self, Self::Error>;
// Provided method
fn try_from_json_object(
object: &Object,
code_map: &CodeMap,
) -> Result<Self, Self::Error> { ... }
}
Expand description
Conversion from JSON syntax object, with code mapping info.
This trait is very similar to TryFrom<Object>
but also passes code
code mapping info to the conversion function.
Required Associated Types§
Required Methods§
Sourcefn try_from_json_object_at(
object: &Object,
code_map: &CodeMap,
offset: usize,
) -> Result<Self, Self::Error>
fn try_from_json_object_at( object: &Object, code_map: &CodeMap, offset: usize, ) -> Result<Self, Self::Error>
Tries to convert the given JSON object into Self
, using the given
code_map
and the offset of object
in the code map.
Note to implementors: use the JsonArray::iter_mapped
and
Object::iter_mapped
methods to visit arrays and objects while
keeping track of the code map offset of each visited item.
Provided Methods§
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.