Skip to content

Commit

Permalink
Cleanup LruCache doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
treeman committed Jul 24, 2014
1 parent 3c45fe9 commit 6bbe92e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/libstd/collections/lru_cache.rs
Expand Up @@ -97,7 +97,7 @@ impl<K: Hash + Eq, V> LruCache<K, V> {
///
/// ```
/// use std::collections::LruCache;
/// let mut cache: LruCache<int, &str> = LruCache::new(10u);
/// let mut cache: LruCache<int, &str> = LruCache::new(10);
/// ```
pub fn new(capacity: uint) -> LruCache<K, V> {
let cache = LruCache {
Expand All @@ -118,7 +118,7 @@ impl<K: Hash + Eq, V> LruCache<K, V> {
///
/// ```
/// use std::collections::LruCache;
/// let mut cache = LruCache::new(2u);
/// let mut cache = LruCache::new(2);
///
/// cache.put(1i, "a");
/// cache.put(2, "b");
Expand Down Expand Up @@ -161,7 +161,7 @@ impl<K: Hash + Eq, V> LruCache<K, V> {
///
/// ```
/// use std::collections::LruCache;
/// let mut cache = LruCache::new(2u);
/// let mut cache = LruCache::new(2);
///
/// cache.put(1i, "a");
/// cache.put(2, "b");
Expand Down Expand Up @@ -195,7 +195,7 @@ impl<K: Hash + Eq, V> LruCache<K, V> {
///
/// ```
/// use std::collections::LruCache;
/// let mut cache = LruCache::new(2u);
/// let mut cache = LruCache::new(2);
///
/// cache.put(2i, "a");
///
Expand All @@ -217,7 +217,7 @@ impl<K: Hash + Eq, V> LruCache<K, V> {
///
/// ```
/// use std::collections::LruCache;
/// let mut cache: LruCache<int, &str> = LruCache::new(2u);
/// let mut cache: LruCache<int, &str> = LruCache::new(2);
/// assert_eq!(cache.capacity(), 2);
/// ```
pub fn capacity(&self) -> uint {
Expand All @@ -231,7 +231,7 @@ impl<K: Hash + Eq, V> LruCache<K, V> {
///
/// ```
/// use std::collections::LruCache;
/// let mut cache = LruCache::new(2u);
/// let mut cache = LruCache::new(2);
///
/// cache.put(1i, "a");
/// cache.put(2, "b");
Expand All @@ -241,16 +241,15 @@ impl<K: Hash + Eq, V> LruCache<K, V> {
/// assert_eq!(cache.get(&2), Some(&"b"));
/// assert_eq!(cache.get(&3), Some(&"c"));
///
/// cache.change_capacity(3u);
/// cache.change_capacity(3);
/// cache.put(1i, "a");
/// cache.put(2, "b");
/// cache.put(3, "c");
///
/// assert_eq!(cache.get(&1), Some(&"a"));
/// assert_eq!(cache.get(&2), Some(&"b"));
/// assert_eq!(cache.get(&3), Some(&"c"));
///
/// cache.change_capacity(1u);
/// cache.change_capacity(1);
///
/// assert_eq!(cache.get(&1), None);
/// assert_eq!(cache.get(&2), None);
Expand Down

5 comments on commit 6bbe92e

@bors
Copy link
Contributor

@bors bors commented on 6bbe92e Jul 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 6bbe92e Jul 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging treeman/rust/doc-lru = 6bbe92e into auto

@bors
Copy link
Contributor

@bors bors commented on 6bbe92e Jul 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

treeman/rust/doc-lru = 6bbe92e merged ok, testing candidate = 32e521f

@bors
Copy link
Contributor

@bors bors commented on 6bbe92e Jul 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 32e521f

Please sign in to comment.