From 4051713625d7b75846619a3ba74d0ada8695c5a9 Mon Sep 17 00:00:00 2001 From: Corey Richardson Date: Fri, 6 Dec 2013 12:33:08 -0500 Subject: [PATCH] Add some Any docs. --- src/libstd/any.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libstd/any.rs b/src/libstd/any.rs index 965b9ffb95c1f..3f139bebb2414 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};