Chris Morgan
›
Git
›
anymap
› commitdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
patch
|
inline
| side by side (from parent 1:
97ec790
)
commit
grep
author
committer
pickaxe
?
search:
re
Use std::convert for AnyMap -> RawAnyMap.
author
Chris Morgan
<me@chrismorgan.info>
Wed, 25 Mar 2015 22:46:51 +0000
committer
Chris Morgan
<me@chrismorgan.info>
Wed, 25 Mar 2015 22:46:51 +0000
src/lib.rs
patch
|
blob
|
history
diff --git
a/src/lib.rs
b/src/lib.rs
index 80769813c38a83755283ce5f92d5b91125ce2ec4..acc0265a0936107ee6fc411549c5799e1bc44af8 100644
(file)
--- a/
src/lib.rs
+++ b/
src/lib.rs
@@
-1,6
+1,6
@@
//! This crate provides the `AnyMap` type, a safe and convenient store for one value of each type.
//! This crate provides the `AnyMap` type, a safe and convenient store for one value of each type.
-#![feature(core, std_misc)]
+#![feature(core, std_misc
, convert
)]
#![cfg_attr(test, feature(test))]
#![warn(missing_docs, unused_results)]
#![cfg_attr(test, feature(test))]
#![warn(missing_docs, unused_results)]
@@
-172,44
+172,24
@@
impl AnyMap {
}),
}
}
}),
}
}
+}
- /// Get a reference to the raw untyped map underlying the `AnyMap`.
- ///
- /// Normal users will not need to use this, but generic libraries working with an `AnyMap` may
- /// just find a use for it occasionally.
- #[inline]
- pub fn as_raw(&self) -> &RawAnyMap {
+impl AsRef<RawAnyMap> for AnyMap {
+ fn as_ref(&self) -> &RawAnyMap {
&self.raw
}
&self.raw
}
+}
- /// Get a mutable reference to the raw untyped map underlying the `AnyMap`.
- ///
- /// Normal users will not need to use this, but generic libraries working with an `AnyMap` may
- /// just find a use for it occasionally.
- #[inline]
- pub fn as_raw_mut(&mut self) -> &mut RawAnyMap {
+impl AsMut<RawAnyMap> for AnyMap {
+ fn as_mut(&mut self) -> &mut RawAnyMap {
&mut self.raw
}
&mut self.raw
}
+}
- /// Convert the `AnyMap` into the raw untyped map that underlyies it.
- ///
- /// Normal users will not need to use this, but generic libraries working with an `AnyMap` may
- /// just find a use for it occasionally.
- #[inline]
- pub fn into_raw(self) -> RawAnyMap {
+impl Into<RawAnyMap> for AnyMap {
+ fn into(self) -> RawAnyMap {
self.raw
}
self.raw
}
-
- /// Convert a raw untyped map into an `AnyMap`.
- ///
- /// Normal users will not need to use this, but generic libraries working with an `AnyMap` may
- /// just find a use for it occasionally.
- #[inline]
- pub fn from_raw(raw: RawAnyMap) -> AnyMap {
- AnyMap {
- raw: raw,
- }
- }
}
/// A view into a single occupied location in an `AnyMap`.
}
/// A view into a single occupied location in an `AnyMap`.