Struct dynamic::Dynamic [] [src]

pub struct Dynamic { /* fields omitted */ }

A dynamically typed value.

Differs from Any in that it pre-computes type information at creation-time, so that downcasting and other queries to the type information can be implemented without virtual calls.

Not Sized, since the size of the type is determined at runtime, so must be used behind a pointer (e.g. &Dynamic, Box<Dynamic>, etc.)

Methods

impl Dynamic
[src]

Create a new, heap-allocated Dynamic value containing the given value.

The resulting Dynamic can be downcasted back to a T.

Create a new, immutable Dynamic value from the given described reference.

The resulting Dynamic can be downcasted back to a T.

Create a new, mutable Dynamic value from the given described reference.

The resulting Dynamic can be downcasted back to a T.

Read the type id for the contained value.

Check if the contained type is a T.

If the contained value is a T, downcast back to it.

If the value is not a T, returns Err(self).

If the contained value is a T, get an immutable reference to it.

If the contained value is a T, get a mutable reference to it.

Trait Implementations

impl Debug for Dynamic
[src]

Formats the value using the given formatter.