Skip to main content

ReflectPath

Trait ReflectPath 

pub trait ReflectPath<'a>: Sized {
    // Required methods
    fn reflect_element(
        self,
        root: &(dyn PartialReflect + 'static),
    ) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'a>>;
    fn reflect_element_mut(
        self,
        root: &mut (dyn PartialReflect + 'static),
    ) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'a>>;

    // Provided methods
    fn element<T>(
        self,
        root: &(dyn PartialReflect + 'static),
    ) -> Result<&T, ReflectPathError<'a>>
       where T: Reflect { ... }
    fn element_mut<T>(
        self,
        root: &mut (dyn PartialReflect + 'static),
    ) -> Result<&mut T, ReflectPathError<'a>>
       where T: Reflect { ... }
}
Expand description

Something that can be interpreted as a reflection path in GetPath.

Required Methods§

fn reflect_element( self, root: &(dyn PartialReflect + 'static), ) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'a>>

Gets a reference to the specified element on the given Reflect object.

See GetPath::reflect_path for more details, see element if you want a typed return value.

fn reflect_element_mut( self, root: &mut (dyn PartialReflect + 'static), ) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'a>>

Gets a mutable reference to the specified element on the given Reflect object.

See GetPath::reflect_path_mut for more details.

Provided Methods§

fn element<T>( self, root: &(dyn PartialReflect + 'static), ) -> Result<&T, ReflectPathError<'a>>
where T: Reflect,

Gets a &T to the specified element on the given Reflect object.

See GetPath::path for more details.

fn element_mut<T>( self, root: &mut (dyn PartialReflect + 'static), ) -> Result<&mut T, ReflectPathError<'a>>
where T: Reflect,

Gets a &mut T to the specified element on the given Reflect object.

See GetPath::path_mut for more details.

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§

§

impl<'a> ReflectPath<'a> for &'a str

§

fn reflect_element( self, root: &(dyn PartialReflect + 'static), ) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'a>>

§

fn reflect_element_mut( self, root: &mut (dyn PartialReflect + 'static), ) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'a>>

Implementors§

§

impl<'a> ReflectPath<'a> for &'a ParsedPath