Trait GetTupleField
pub trait GetTupleField {
// Required methods
fn get_field<T>(&self, index: usize) -> Option<&T>
where T: Reflect;
fn get_field_mut<T>(&mut self, index: usize) -> Option<&mut T>
where T: Reflect;
}Expand description
A convenience trait which combines fetching and downcasting of tuple fields.
§Example
use bevy_reflect::GetTupleField;
let foo = ("blue".to_string(), 42_i32);
assert_eq!(foo.get_field::<String>(0), Some(&"blue".to_string()));
assert_eq!(foo.get_field::<i32>(1), Some(&42));Required Methods§
fn get_field<T>(&self, index: usize) -> Option<&T>where
T: Reflect,
fn get_field<T>(&self, index: usize) -> Option<&T>where
T: Reflect,
Returns a reference to the value of the field with index index,
downcast to T.
fn get_field_mut<T>(&mut self, index: usize) -> Option<&mut T>where
T: Reflect,
fn get_field_mut<T>(&mut self, index: usize) -> Option<&mut T>where
T: Reflect,
Returns a mutable reference to the value of the field with index
index, downcast to T.
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.