Enum ReflectOwned
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>)
An owned struct-like type.
TupleStruct(Box<dyn TupleStruct>)
An owned tuple-struct-like type.
Tuple(Box<dyn Tuple>)
An owned tuple-like type.
List(Box<dyn List>)
An owned list-like type.
Array(Box<dyn Array>)
An owned array-like type.
Map(Box<dyn Map>)
An owned map-like type.
Set(Box<dyn Set>)
An owned set-like type.
Enum(Box<dyn Enum>)
An owned enum-like type.
Opaque(Box<dyn PartialReflect>)
An owned opaque type.
Implementations§
§impl ReflectOwned
impl ReflectOwned
pub fn kind(&self) -> ReflectKind
pub fn kind(&self) -> ReflectKind
Returns the “kind” of this reflected type without any information.
§impl ReflectOwned
impl ReflectOwned
pub 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.
pub 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.
pub 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.
pub 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.
pub 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.
pub fn into_map(self) -> Result<Box<dyn Map>, ReflectKindMismatchError>
pub fn into_map(self) -> Result<Box<dyn Map>, ReflectKindMismatchError>
pub fn into_set(self) -> Result<Box<dyn Set>, ReflectKindMismatchError>
pub fn into_set(self) -> Result<Box<dyn Set>, ReflectKindMismatchError>
pub 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.
pub 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§
§impl From<ReflectOwned> for ReflectKind
impl From<ReflectOwned> for ReflectKind
§fn from(value: ReflectOwned) -> ReflectKind
fn from(value: ReflectOwned) -> ReflectKind
Auto Trait Implementations§
impl Freeze for ReflectOwned
impl !RefUnwindSafe for ReflectOwned
impl Send for ReflectOwned
impl Sync for ReflectOwned
impl Unpin for ReflectOwned
impl UnsafeUnpin 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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
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>
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>
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 more