Skip to main content

Object

Trait Object 

Source
pub trait Object<'doc>:
    Serialize
    + Deserialize<'doc>
    + Clone {
    // Required methods
    fn get_type(&self) -> ObjectType;
    fn has_key(&self, key: &str) -> bool;
    fn has_index(&self, idx: usize) -> bool;
    fn at_index<'a>(&'a self, idx: usize) -> Result<Option<&'a Self>>;
    fn at_index_mut<'a>(
        &'a mut self,
        idx: usize,
    ) -> Result<Option<&'a mut Self>>;
    fn at_key<'a>(&'a self, key: &str) -> Result<Option<&'a Self>>;
    fn at_key_mut<'a>(&'a mut self, key: &str) -> Result<Option<&'a mut Self>>;
    fn array_len(&self) -> Option<usize>;
}

Required Methods§

Source

fn get_type(&self) -> ObjectType

Source

fn has_key(&self, key: &str) -> bool

Source

fn has_index(&self, idx: usize) -> bool

Source

fn at_index<'a>(&'a self, idx: usize) -> Result<Option<&'a Self>>

Source

fn at_index_mut<'a>(&'a mut self, idx: usize) -> Result<Option<&'a mut Self>>

Source

fn at_key<'a>(&'a self, key: &str) -> Result<Option<&'a Self>>

Source

fn at_key_mut<'a>(&'a mut self, key: &str) -> Result<Option<&'a mut Self>>

Source

fn array_len(&self) -> Option<usize>

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.

Implementations on Foreign Types§

Source§

impl<'doc> Object<'doc> for Value

Available on crate feature backend_serde_json only.
Source§

fn get_type(&self) -> ObjectType

Source§

fn has_key(&self, key: &str) -> bool

Source§

fn has_index(&self, idx: usize) -> bool

Source§

fn at_index<'a>(&'a self, idx: usize) -> Result<Option<&'a Self>>

Source§

fn at_index_mut<'a>(&'a mut self, idx: usize) -> Result<Option<&'a mut Self>>

Source§

fn at_key<'a>(&'a self, key: &str) -> Result<Option<&'a Self>>

Source§

fn at_key_mut<'a>(&'a mut self, key: &str) -> Result<Option<&'a mut Self>>

Source§

fn array_len(&self) -> Option<usize>

Source§

impl<'doc> Object<'doc> for Value

Available on crate feature backend_toml only.
Source§

fn get_type(&self) -> ObjectType

Source§

fn has_key(&self, key: &str) -> bool

Source§

fn has_index(&self, idx: usize) -> bool

Source§

fn at_index<'a>(&'a self, idx: usize) -> Result<Option<&'a Self>>

Source§

fn at_index_mut<'a>(&'a mut self, idx: usize) -> Result<Option<&'a mut Self>>

Source§

fn at_key<'a>(&'a self, key: &str) -> Result<Option<&'a Self>>

Source§

fn at_key_mut<'a>(&'a mut self, key: &str) -> Result<Option<&'a mut Self>>

Source§

fn array_len(&self) -> Option<usize>

Implementors§