# Trait std::any::Any
[−]
[src]

pub trait Any: 'static + Reflect { fn get_type_id(&self) -> TypeId; }

A type to emulate dynamic typing.

Every type with no non-`'static`

references implements `Any`

.
See the module-level documentation for more details.

## Required Methods

`fn get_type_id(&self) -> TypeId`

*Unstable (*

`get_type_id`

#27745): this method will likely be replaced by an associated static

Gets the `TypeId`

of `self`

.

## Methods

`impl Any + 'static`

`fn is<T>(&self) -> bool where T: Any`

Returns true if the boxed type is the same as `T`

`fn downcast_ref<T>(&self) -> Option<&T> where T: Any`

Returns some reference to the boxed value if it is of type `T`

, or
`None`

if it isn't.

`fn downcast_mut<T>(&mut self) -> Option<&mut T> where T: Any`

Returns some mutable reference to the boxed value if it is of type `T`

, or
`None`

if it isn't.

`impl Any + 'static + Send`

`fn is<T>(&self) -> bool where T: Any`

Forwards to the method defined on the type `Any`

.

`fn downcast_ref<T>(&self) -> Option<&T> where T: Any`

Forwards to the method defined on the type `Any`

.

`fn downcast_mut<T>(&mut self) -> Option<&mut T> where T: Any`

Forwards to the method defined on the type `Any`

.