diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-08-12 16:26:45 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-08-12 16:26:45 -0700 |
| commit | 78d19d8f1bdb64317ebdb072c25ee1240a562095 (patch) | |
| tree | 4b2a7f9e3cfbcc8114d4ab8873b785619beacd6f /src/libstd | |
| parent | 9169a1b26a556bbd5befd344a5b0912901859e5d (diff) | |
| download | rust-78d19d8f1bdb64317ebdb072c25ee1240a562095.tar.gz rust-78d19d8f1bdb64317ebdb072c25ee1240a562095.zip | |
std: Add cell to the std crate and make it build
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/cell.rs | 7 | ||||
| -rw-r--r-- | src/libstd/std.rc | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs index d32a47a8ab5..734eb0af8fe 100644 --- a/src/libstd/cell.rs +++ b/src/libstd/cell.rs @@ -18,10 +18,10 @@ fn empty_cell<T>() -> Cell<T> { impl<T> Cell<T> { /// Yields the value, failing if the cell is empty. fn take() -> T { - let value = none; + let mut value = none; value <-> self.value; if value.is_none() { - fail "attempt to take an empty cell"; + fail ~"attempt to take an empty cell"; } return option::unwrap(value); } @@ -29,7 +29,7 @@ impl<T> Cell<T> { /// Returns the value, failing if the cell is full. fn put_back(+value: T) { if self.value.is_none() { - fail "attempt to put a value back into a full cell"; + fail ~"attempt to put a value back into a full cell"; } self.value = some(move value); } @@ -39,4 +39,3 @@ impl<T> Cell<T> { self.value.is_none() } } - diff --git a/src/libstd/std.rc b/src/libstd/std.rc index dfc659781de..b2d9d3770fc 100644 --- a/src/libstd/std.rc +++ b/src/libstd/std.rc @@ -26,6 +26,7 @@ export ebml, dbg, getopts, json, rand, sha1, term, time, prettyprint; export test, tempfile, serialization; export cmp; export base64; +export cell; // General io and system-services modules @@ -45,6 +46,7 @@ mod uv_global_loop; mod c_vec; mod timer; +mod cell; // Concurrency |
