Trait json_syntax::TryFromJsonObject
source · 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§
Object Safety§
This trait is not object safe.