pub enum ReferencePart {
StringAccess(Cow<'static, str>),
IntegerAccess(i64),
MapAccess(Box<dyn PartialReflect>),
}Expand description
A key referencing into a Reflect supporting trait object.
Variants§
StringAccess(Cow<'static, str>)
A string labelled reference
IntegerAccess(i64)
An integer labelled reference, always 0-based, see ReferencePart::new_from_script_val
MapAccess(Box<dyn PartialReflect>)
A key to a map or set,
Implementations§
Source§impl ReferencePart
impl ReferencePart
Sourcepub fn expect_string(&self) -> Result<&str, ()>
pub fn expect_string(&self) -> Result<&str, ()>
Expect this reference to be a string, and return it if it is
Sourcepub fn expect_integer(&self) -> Result<i64, ()>
pub fn expect_integer(&self) -> Result<i64, ()>
Expect this reference to be an integer, and return it if it is
Sourcepub fn with_any<O, F>(&self, f: F) -> Owhere
F: FnOnce(&(dyn PartialReflect + 'static)) -> O,
pub fn with_any<O, F>(&self, f: F) -> Owhere
F: FnOnce(&(dyn PartialReflect + 'static)) -> O,
Casts the keys into a partial reflect value regardless of type of access
Sourcepub fn new_from_script_val(
value: ScriptValue,
language: Language,
world: Option<WorldAccessGuard<'_>>,
) -> Result<ReferencePart, ScriptValue>
pub fn new_from_script_val( value: ScriptValue, language: Language, world: Option<WorldAccessGuard<'_>>, ) -> Result<ReferencePart, ScriptValue>
Converts a ScriptValue to a reference part, integers are converted to 0-based indices for one-indexed languages.
If given a world guard also supports arbitrary references as keys
Sourcepub fn reflect_element<'a>(
&self,
elem: &'a (dyn PartialReflect + 'static),
_type_registry: &TypeRegistry,
) -> Result<Option<&'a (dyn PartialReflect + 'static)>, ()>
pub fn reflect_element<'a>( &self, elem: &'a (dyn PartialReflect + 'static), _type_registry: &TypeRegistry, ) -> Result<Option<&'a (dyn PartialReflect + 'static)>, ()>
Tries to reference into the given root object with the current reference part
Sourcepub fn reflect_element_mut<'a>(
&self,
elem: &'a mut (dyn PartialReflect + 'static),
_type_registry: &TypeRegistry,
) -> Result<Option<&'a mut (dyn PartialReflect + 'static)>, ()>
pub fn reflect_element_mut<'a>( &self, elem: &'a mut (dyn PartialReflect + 'static), _type_registry: &TypeRegistry, ) -> Result<Option<&'a mut (dyn PartialReflect + 'static)>, ()>
Tries to reference into the given root object with the current reference part
Trait Implementations§
Source§impl Clone for ReferencePart
impl Clone for ReferencePart
Source§fn clone(&self) -> ReferencePart
fn clone(&self) -> ReferencePart
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReferencePart
impl Debug for ReferencePart
Source§impl DebugWithTypeInfo for ReferencePart
impl DebugWithTypeInfo for ReferencePart
Source§fn to_string_with_type_info(
&self,
f: &mut Formatter<'_>,
type_info_provider: Option<&WorldAccessGuard<'_>>,
) -> Result<(), Error>
fn to_string_with_type_info( &self, f: &mut Formatter<'_>, type_info_provider: Option<&WorldAccessGuard<'_>>, ) -> Result<(), Error>
Format the value using the provided type info provider if available
Source§impl Display for ReferencePart
impl Display for ReferencePart
Auto Trait Implementations§
impl !RefUnwindSafe for ReferencePart
impl !UnwindSafe for ReferencePart
impl Forget for ReferencePart
impl Freeze for ReferencePart
impl Move for ReferencePart
impl Send for ReferencePart
impl Sync for ReferencePart
impl Unpin for ReferencePart
impl UnsafeUnpin for ReferencePart
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
impl<T> Context for T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.
impl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSync for Twhere
T: Sync,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Settings for T
Source§impl<T> Template for T
impl<T> Template for T
Source§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
Uses this template and the given
entity context to produce a Template::Output.Source§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clones this template. See
Clone.Source§impl<T> TypeData for T
impl<T> TypeData for T
Source§fn clone_type_data(&self) -> Box<dyn TypeData>
fn clone_type_data(&self) -> Box<dyn TypeData>
Creates a type-erased clone of
self.