pub enum ReflectOwned {
Struct(Box<dyn Struct>),
TupleStruct(Box<dyn TupleStruct>),
Tuple(Box<dyn Tuple>),
List(Box<dyn List>),
Array(Box<dyn Array>),
Map(Box<dyn Map>),
Set(Box<dyn Set>),
Enum(Box<dyn Enum>),
Opaque(Box<dyn PartialReflect>),
}
Expand description
An owned enumeration of “kinds” of a reflected type.
Each variant contains a trait object with methods specific to a kind of type.
A ReflectOwned
is obtained via PartialReflect::reflect_owned
.
Variants§
Struct(Box<dyn Struct>)
TupleStruct(Box<dyn TupleStruct>)
Tuple(Box<dyn Tuple>)
List(Box<dyn List>)
Array(Box<dyn Array>)
Map(Box<dyn Map>)
Set(Box<dyn Set>)
Enum(Box<dyn Enum>)
Opaque(Box<dyn PartialReflect>)
Implementations§
Source§impl ReflectOwned
impl ReflectOwned
Sourcepub fn kind(&self) -> ReflectKind
pub fn kind(&self) -> ReflectKind
Returns the “kind” of this reflected type without any information.
Source§impl ReflectOwned
impl ReflectOwned
Sourcepub fn into_struct(self) -> Result<Box<dyn Struct>, ReflectKindMismatchError>
pub fn into_struct(self) -> Result<Box<dyn Struct>, ReflectKindMismatchError>
Attempts a cast to a Struct
trait object.
Returns an error if self
is not the Self::Struct
variant.
Sourcepub fn into_tuple_struct(
self,
) -> Result<Box<dyn TupleStruct>, ReflectKindMismatchError>
pub fn into_tuple_struct( self, ) -> Result<Box<dyn TupleStruct>, ReflectKindMismatchError>
Attempts a cast to a TupleStruct
trait object.
Returns an error if self
is not the Self::TupleStruct
variant.
Sourcepub fn into_tuple(self) -> Result<Box<dyn Tuple>, ReflectKindMismatchError>
pub fn into_tuple(self) -> Result<Box<dyn Tuple>, ReflectKindMismatchError>
Attempts a cast to a Tuple
trait object.
Returns an error if self
is not the Self::Tuple
variant.
Sourcepub fn into_list(self) -> Result<Box<dyn List>, ReflectKindMismatchError>
pub fn into_list(self) -> Result<Box<dyn List>, ReflectKindMismatchError>
Attempts a cast to a List
trait object.
Returns an error if self
is not the Self::List
variant.
Sourcepub fn into_array(self) -> Result<Box<dyn Array>, ReflectKindMismatchError>
pub fn into_array(self) -> Result<Box<dyn Array>, ReflectKindMismatchError>
Attempts a cast to a Array
trait object.
Returns an error if self
is not the Self::Array
variant.
Sourcepub fn into_enum(self) -> Result<Box<dyn Enum>, ReflectKindMismatchError>
pub fn into_enum(self) -> Result<Box<dyn Enum>, ReflectKindMismatchError>
Attempts a cast to a Enum
trait object.
Returns an error if self
is not the Self::Enum
variant.
Sourcepub fn into_value(
self,
) -> Result<Box<dyn PartialReflect>, ReflectKindMismatchError>
pub fn into_value( self, ) -> Result<Box<dyn PartialReflect>, ReflectKindMismatchError>
Attempts a cast to a PartialReflect
trait object.
Returns an error if self
is not the Self::Opaque
variant.
Trait Implementations§
Source§impl From<ReflectOwned> for ReflectKind
impl From<ReflectOwned> for ReflectKind
Source§fn from(value: ReflectOwned) -> Self
fn from(value: ReflectOwned) -> Self
Auto Trait Implementations§
impl Freeze for ReflectOwned
impl !RefUnwindSafe for ReflectOwned
impl Send for ReflectOwned
impl Sync for ReflectOwned
impl Unpin for ReflectOwned
impl !UnwindSafe for ReflectOwned
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
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>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<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>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
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)
&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)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.