Skip to main content

JsonObjectAccess

Trait JsonObjectAccess 

Source
pub trait JsonObjectAccess<'a, F: Json> {
    type Node: JsonNode<'a, F>;
    type MemberName: AsRef<str> + Into<Cow<'a, str>>;
    type MembersIter: Iterator<Item = (Self::MemberName, Self::Node)>;

    // Required methods
    fn len(&self) -> usize;
    fn get(&self, key: &F::PreparedKey) -> Option<Self::Node>;
    fn members(&self) -> Self::MembersIter;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}

Required Associated Types§

Source

type Node: JsonNode<'a, F>

Source

type MemberName: AsRef<str> + Into<Cow<'a, str>>

Member name handle; a plain &str where the representation can borrow, owned elsewhere.

Source

type MembersIter: Iterator<Item = (Self::MemberName, Self::Node)>

Required Methods§

Source

fn len(&self) -> usize

Source

fn get(&self, key: &F::PreparedKey) -> Option<Self::Node>

Source

fn members(&self) -> Self::MembersIter

Provided Methods§

Source

fn is_empty(&self) -> bool

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a> JsonObjectAccess<'a, SerdeJson> for &'a Map<String, Value>

Source§

type Node = &'a Value

Source§

type MemberName = &'a str

Source§

type MembersIter = SerdeMembersIter<'a>

Source§

fn len(&self) -> usize

Source§

fn get(&self, key: &String) -> Option<&'a Value>

Source§

fn members(&self) -> SerdeMembersIter<'a>

Implementors§