Register new snapshots

This commit is contained in:
Alex Crichton 2013-11-30 16:38:07 -08:00
parent 4252a24ae1
commit acc5e32e53
18 changed files with 23 additions and 94 deletions

View file

@ -12,51 +12,12 @@
//! of any type.
use cast::transmute;
#[cfg(stage0)]
use cmp::Eq;
use option::{Option, Some, None};
#[cfg(stage0)]
use to_bytes::{IterBytes, Cb};
use to_str::ToStr;
use unstable::intrinsics;
use util::Void;
#[cfg(not(stage0))]
use unstable::intrinsics::TypeId;
///////////////////////////////////////////////////////////////////////////////
// TypeId
///////////////////////////////////////////////////////////////////////////////
/// `TypeId` represents a globally unique identifier for a type
#[cfg(stage0)]
pub struct TypeId {
priv t: u64,
}
#[cfg(stage0)]
impl TypeId {
/// Returns the `TypeId` of the type this generic function has been instantiated with
#[inline]
pub fn of<T: 'static>() -> TypeId {
TypeId{ t: unsafe { intrinsics::type_id::<T>() } }
}
}
#[cfg(stage0)]
impl Eq for TypeId {
#[inline]
fn eq(&self, &other: &TypeId) -> bool {
self.t == other.t
}
}
#[cfg(stage0)]
impl IterBytes for TypeId {
fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {
self.t.iter_bytes(lsb0, f)
}
}
///////////////////////////////////////////////////////////////////////////////
// Any trait
///////////////////////////////////////////////////////////////////////////////