diff options
| author | bors <bors@rust-lang.org> | 2013-12-09 05:51:29 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-12-09 05:51:29 -0800 |
| commit | 4e0cb316fc980f00e1b74f3fdb7a842b540be280 (patch) | |
| tree | 51362992c913303ab3c2ac8e4a88d86f3c061f74 /src/libstd | |
| parent | a417dbd1c71c168fe7db71efb98d22b5e22dcce1 (diff) | |
| parent | 4051713625d7b75846619a3ba74d0ada8695c5a9 (diff) | |
| download | rust-4e0cb316fc980f00e1b74f3fdb7a842b540be280.tar.gz rust-4e0cb316fc980f00e1b74f3fdb7a842b540be280.zip | |
auto merge of #10840 : cmr/rust/any_docs2, r=huonw
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/any.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstd/any.rs b/src/libstd/any.rs index 6a3e6933001..4133bb1835d 100644 --- a/src/libstd/any.rs +++ b/src/libstd/any.rs @@ -9,7 +9,14 @@ // except according to those terms. //! This module implements the `Any` trait, which enables dynamic typing -//! of any type. +//! of any type, through runtime reflection. +//! +//! `Any` itself can be used to get a `TypeId`, and has more features when used as a trait object. +//! As `&Any` (a borrowed trait object), it has the `is` and `as_ref` methods, to test if the +//! contained value is of a given type, and to get a reference to the inner value as a type. As +//! `&mut Any`, there is also the `as_mut` method, for getting a mutable reference to the inner +//! value. `~Any` adds the `move` method, which will unwrap a `~T` from the object. See the +//! extension traits (`*Ext`) for the full details. use cast::transmute; use option::{Option, Some, None}; |
