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§
Provided Methods§
Sourcefn value<E>(
&self,
invalid: impl FnOnce() -> E,
parts: impl Borrow<KeyPath>,
) -> Result<Option<&Value>, E>
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.
Sourcefn value_mut<E>(
&mut self,
invalid: impl FnOnce() -> E,
parts: impl Borrow<KeyPath>,
) -> Result<Option<&mut Value>, E>
fn value_mut<E>( &mut self, invalid: impl FnOnce() -> E, parts: impl Borrow<KeyPath>, ) -> Result<Option<&mut Value>, E>
Mutable version of LSDGetExt::value.
Sourcefn parsed<T: FromStr, E: Clone>(
&self,
invalid: impl FnOnce() -> E + Clone,
parts: impl Borrow<KeyPath>,
) -> Result<Option<T>, E>
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.
Sourcefn list<E>(
&self,
invalid: impl FnOnce() -> E,
parts: impl Borrow<KeyPath>,
) -> Result<Option<&List>, E>
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.
Sourcefn list_mut<E>(
&mut self,
invalid: impl FnOnce() -> E,
parts: impl Borrow<KeyPath>,
) -> Result<Option<&mut List>, E>
fn list_mut<E>( &mut self, invalid: impl FnOnce() -> E, parts: impl Borrow<KeyPath>, ) -> Result<Option<&mut List>, E>
Mutable version of LSDGetExt::list.
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.