LSDGetExt

Trait LSDGetExt 

Source
pub trait LSDGetExt {
    // Required methods
    fn inner(&self, parts: impl Borrow<KeyPath>) -> Option<&LSD>;
    fn inner_mut(&mut self, parts: impl Borrow<KeyPath>) -> Option<&mut LSD>;

    // Provided methods
    fn value<E>(
        &self,
        invalid: impl FnOnce() -> E,
        parts: impl Borrow<KeyPath>,
    ) -> Result<Option<&Value>, E> { ... }
    fn value_mut<E>(
        &mut self,
        invalid: impl FnOnce() -> E,
        parts: impl Borrow<KeyPath>,
    ) -> Result<Option<&mut Value>, E> { ... }
    fn parsed<T: FromStr, E: Clone>(
        &self,
        invalid: impl FnOnce() -> E + Clone,
        parts: impl Borrow<KeyPath>,
    ) -> Result<Option<T>, E> { ... }
    fn list<E>(
        &self,
        invalid: impl FnOnce() -> E,
        parts: impl Borrow<KeyPath>,
    ) -> Result<Option<&List>, E> { ... }
    fn list_mut<E>(
        &mut self,
        invalid: impl FnOnce() -> E,
        parts: impl Borrow<KeyPath>,
    ) -> Result<Option<&mut List>, E> { ... }
    fn level<E>(
        &self,
        invalid: impl FnOnce() -> E,
        parts: impl Borrow<KeyPath>,
    ) -> Result<Option<&Level>, E> { ... }
    fn level_mut<E>(
        &mut self,
        invalid: impl FnOnce() -> E,
        parts: impl Borrow<KeyPath>,
    ) -> Result<Option<&mut Level>, E> { ... }
}
Expand description

Extensions for LSD types that can pull deeply nested values.

Required Methods§

Source

fn inner(&self, parts: impl Borrow<KeyPath>) -> Option<&LSD>

Try to get an inner LSD given by the path.

Source

fn inner_mut(&mut self, parts: impl Borrow<KeyPath>) -> Option<&mut LSD>

Mutable version of LSDGetExt::inner.

Provided Methods§

Source

fn value<E>( &self, invalid: impl FnOnce() -> E, parts: impl Borrow<KeyPath>, ) -> Result<Option<&Value>, E>

Try to find an inner LSD::Value given by the path.

Source

fn value_mut<E>( &mut self, invalid: impl FnOnce() -> E, parts: impl Borrow<KeyPath>, ) -> Result<Option<&mut Value>, E>

Mutable version of LSDGetExt::value.

Source

fn parsed<T: FromStr, E: Clone>( &self, invalid: impl FnOnce() -> E + Clone, parts: impl Borrow<KeyPath>, ) -> Result<Option<T>, E>

Try to find a value given by the path, and parse it as the given type.

Source

fn list<E>( &self, invalid: impl FnOnce() -> E, parts: impl Borrow<KeyPath>, ) -> Result<Option<&List>, E>

Try to find an inner LSD::List given by the path.

Source

fn list_mut<E>( &mut self, invalid: impl FnOnce() -> E, parts: impl Borrow<KeyPath>, ) -> Result<Option<&mut List>, E>

Mutable version of LSDGetExt::list.

Source

fn level<E>( &self, invalid: impl FnOnce() -> E, parts: impl Borrow<KeyPath>, ) -> Result<Option<&Level>, E>

Try to find an inner LSD::Level given by the path.

Source

fn level_mut<E>( &mut self, invalid: impl FnOnce() -> E, parts: impl Borrow<KeyPath>, ) -> Result<Option<&mut Level>, E>

Mutable version of LSDGetExt::level.

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.

Implementors§