Chris Morgan
›
Git
›
anymap
› commitdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
patch
|
inline
| side by side (from parent 1:
512885e
)
commit
grep
author
committer
pickaxe
?
search:
re
Rust update.
author
Chris Morgan
<me@chrismorgan.info>
Sun, 2 Nov 2014 10:45:52 +0000
committer
Chris Morgan
<me@chrismorgan.info>
Sun, 2 Nov 2014 10:45:52 +0000
src/lib.rs
patch
|
blob
|
history
diff --git
a/src/lib.rs
b/src/lib.rs
index 94410f07050d06e7fb2a97e09d4cbdfb028c6552..3e716ce5fc345a96855925e8f5c1644d4516bdb2 100644
(file)
--- a/
src/lib.rs
+++ b/
src/lib.rs
@@
-3,16
+3,16
@@
#![crate_name = "anymap"]
#![crate_type = "lib"]
#![feature(default_type_params)]
#![crate_name = "anymap"]
#![crate_type = "lib"]
#![feature(default_type_params)]
-#![warn(un
necessary_qualification, non_uppercase_static
s,
- variant_size_difference
, unnecessary_typecast
,
- missing_doc
, unused_result
)]
+#![warn(un
used_qualifications, non_upper_case_global
s,
+ variant_size_difference
s, unused_typecasts
,
+ missing_doc
s, unused_results
)]
#[cfg(test)]
extern crate test;
use std::any::Any;
use std::intrinsics::TypeId;
#[cfg(test)]
extern crate test;
use std::any::Any;
use std::intrinsics::TypeId;
-use std::collections::
{Collection, HashMap, Mutable}
;
+use std::collections::
HashMap
;
use std::hash::{Hash, Hasher, Writer};
use std::mem::{transmute, transmute_copy};
use std::raw::TraitObject;
use std::hash::{Hash, Hasher, Writer};
use std::mem::{transmute, transmute_copy};
use std::raw::TraitObject;
@@
-37,7
+37,7
@@
impl Writer for TypeIdState {
}
impl Hasher<TypeIdState> for TypeIdHasher {
}
impl Hasher<TypeIdState> for TypeIdHasher {
- fn hash<T: Hash<TypeIdState>>(&self, value: &T) -> u64 {
+ fn hash<
Sized?
T: Hash<TypeIdState>>(&self, value: &T) -> u64 {
let mut state = TypeIdState {
value: 0,
};
let mut state = TypeIdState {
value: 0,
};
@@
-146,20
+146,19
@@
impl AnyMap {
pub fn contains<T: 'static>(&self) -> bool {
self.data.contains_key(&TypeId::of::<T>())
}
pub fn contains<T: 'static>(&self) -> bool {
self.data.contains_key(&TypeId::of::<T>())
}
-}
-impl Collection for AnyMap {
- fn len(&self) -> uint {
+ /// Returns the number of items in the collection.
+
pub
fn len(&self) -> uint {
self.data.len()
}
self.data.len()
}
- fn is_empty(&self) -> bool {
+ /// Returns true if there are no items in the collection.
+ pub fn is_empty(&self) -> bool {
self.data.is_empty()
}
self.data.is_empty()
}
-}
-impl Mutable for AnyMap {
- fn clear(&mut self) {
+ /// Removes all items from the collection.
+
pub
fn clear(&mut self) {
self.data.clear();
}
}
self.data.clear();
}
}