core: Inherit the any module

This commit is contained in:
Alex Crichton 2014-04-30 20:36:58 -07:00
parent 85a8e6b80a
commit 8ed728babb
4 changed files with 10 additions and 19 deletions

View File

@ -21,7 +21,6 @@
//! the extension traits (`*Ext`) for the full details.
use cast::{transmute, transmute_copy};
use fmt;
use option::{Option, Some, None};
use owned::Box;
use raw::TraitObject;
@ -145,22 +144,6 @@ impl AnyOwnExt for Box<Any> {
}
}
///////////////////////////////////////////////////////////////////////////////
// Trait implementations
///////////////////////////////////////////////////////////////////////////////
impl fmt::Show for Box<Any> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Box<Any>")
}
}
impl<'a> fmt::Show for &'a Any {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("&Any")
}
}
#[cfg(test)]
mod tests {
use prelude::*;

View File

@ -37,5 +37,6 @@ pub mod container;
/* Core types and methods on primitives */
pub mod any;
pub mod finally;
pub mod char;

View File

@ -1242,6 +1242,14 @@ impl<T> Show for *mut T {
fn fmt(&self, f: &mut Formatter) -> Result { secret_pointer(self, f) }
}
impl Show for Box<any::Any> {
fn fmt(&self, f: &mut Formatter) -> Result { f.pad("Box<Any>") }
}
impl<'a> Show for &'a any::Any {
fn fmt(&self, f: &mut Formatter) -> Result { f.pad("&Any") }
}
impl Show for TypeId {
fn fmt(&self, f: &mut Formatter) -> Result {
write!(f.buf, "TypeId \\{ {} \\}", self.hash())

View File

@ -137,6 +137,7 @@ extern crate core;
#[cfg(not(test))] pub use ops = core::ops;
#[cfg(not(test))] pub use ty = core::ty;
pub use core::any;
pub use core::cast;
pub use core::char;
pub use core::container;
@ -218,8 +219,6 @@ pub mod iter;
pub mod to_str;
pub mod clone;
pub mod hash;
pub mod default;
pub mod any;
/* Common data structures */