Skip to main content

ObjectView

Trait ObjectView 

Source
pub trait ObjectView<'a>: Copy {
    type Item: Instance<'a>;

    // Required methods
    fn len(self) -> usize;
    fn get(self, name: &str) -> Option<Self::Item>;
    fn iter(self) -> impl Iterator<Item = (&'a str, Self::Item)>;

    // Provided methods
    fn is_empty(self) -> bool { ... }
    fn contains_key(self, name: &str) -> bool { ... }
    fn values(self) -> impl Iterator<Item = Self::Item> { ... }
}
Expand description

The properties of an object, in their order.

Required Associated Types§

Required Methods§

Source

fn len(self) -> usize

Source

fn get(self, name: &str) -> Option<Self::Item>

The value of a property.

Source

fn iter(self) -> impl Iterator<Item = (&'a str, Self::Item)>

Provided Methods§

Source

fn is_empty(self) -> bool

Source

fn contains_key(self, name: &str) -> bool

Source

fn values(self) -> impl Iterator<Item = Self::Item>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<'a> ObjectView<'a> for &'a Map<String, Value>

Source§

type Item = &'a Value

Source§

fn len(self) -> usize

Source§

fn get(self, name: &str) -> Option<&'a Value>

Source§

fn contains_key(self, name: &str) -> bool

Source§

fn iter(self) -> impl Iterator<Item = (&'a str, &'a Value)>

Source§

fn values(self) -> impl Iterator<Item = &'a Value>

Implementors§