logo
pub trait GetPath {
    fn path(
        &'r self,
        path: &'p str
    ) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>; fn path_mut(
        &'r mut self,
        path: &'p str
    ) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>; fn get_path<T>(
        &'r self,
        path: &'p str
    ) -> Result<&'r T, ReflectPathError<'p>>
    where
        T: Reflect
, { ... } fn get_path_mut<T>(
        &'r mut self,
        path: &'p str
    ) -> Result<&'r mut T, ReflectPathError<'p>>
    where
        T: Reflect
, { ... } }
Expand description

A trait which allows nested values to be retrieved with path strings.

Path strings use Rust syntax:

  • Struct items are accessed with a dot and a field name: .field_name
  • TupleStruct and Tuple items are accessed with a dot and a number: .0
  • List items are accessed with brackets: [0]

If the initial path element is a field of a struct, tuple struct, or tuple, the initial ‘.’ may be omitted.

For example, given a struct with a field foo which is a reflected list of 2-tuples (like a Vec<(T, U)>), the path string foo[3].0 would access tuple element 0 of element 3 of foo.

Required Methods

Returns a reference to the value specified by path.

To retrieve a statically typed reference, use get_path.

Returns a mutable reference to the value specified by path.

To retrieve a statically typed mutable reference, use get_path_mut.

Provided Methods

Returns a statically typed reference to the value specified by path.

Returns a statically typed mutable reference to the value specified by path.

Implementors