bevy_reflect

Trait ReflectPath

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

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

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

Required Methods§

Source

fn reflect_element( self, root: &dyn Reflect, ) -> Result<&dyn Reflect, 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.

Source

fn reflect_element_mut( self, root: &mut dyn Reflect, ) -> Result<&mut dyn Reflect, 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§

Source

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

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

See GetPath::path for more details.

Source

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

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§

Source§

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

Source§

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

Source§

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

Implementors§

Source§

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