about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-09-14 02:30:59 -0700
committerbors <bors@rust-lang.org>2013-09-14 02:30:59 -0700
commitf853f0b2d65aef97fb88d569d5636eaeae6bb369 (patch)
tree6ad74e9a9ae9b6303331e656231767c41e7865f7 /src/libstd
parentfbafb41fff33cf9a7709ef50f7525fa5f9930d2b (diff)
parentd0462f070cf2a94a8720e6d5b939f32ba330c4eb (diff)
downloadrust-f853f0b2d65aef97fb88d569d5636eaeae6bb369.tar.gz
rust-f853f0b2d65aef97fb88d569d5636eaeae6bb369.zip
auto merge of #9160 : alexcrichton/rust/local-data-docs, r=huonw
Remove references to local_data::Key and only mention the macro for how to
construct new keys into local data.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/local_data.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libstd/local_data.rs b/src/libstd/local_data.rs
index a13c75635dc..89bdb57e2bd 100644
--- a/src/libstd/local_data.rs
+++ b/src/libstd/local_data.rs
@@ -17,9 +17,10 @@ anywhere within a task, keyed by a global pointer parameterized over the type of
 the TLS slot.  Useful for dynamic variables, singletons, and interfacing with
 foreign code with bad callback interfaces.
 
-To use, declare a static variable of the type you wish to store. The
-initialization should be `&local_data::Key`. This is then the key to what you
-wish to store.
+To declare a new key for storing local data of a particular type, use the
+`local_data_key!` macro. This macro will expand to a `static` item apppriately
+named and annotated. This name is then passed to the functions in this module to
+modify/read the slot specified by the key.
 
 ~~~{.rust}
 use std::local_data;
@@ -31,14 +32,14 @@ local_data::set(key_int, 3);
 local_data::get(key_int, |opt| assert_eq!(opt, Some(&3)));
 
 local_data::set(key_vector, ~[4]);
-local_data::get(key_int, |opt| assert_eq!(opt, Some(&~[4])));
+local_data::get(key_vector, |opt| assert_eq!(opt, Some(&~[4])));
 ~~~
 
-Casting 'Arcane Sight' reveals an overwhelming aura of Transmutation
-magic.
-
 */
 
+// Casting 'Arcane Sight' reveals an overwhelming aura of Transmutation
+// magic.
+
 use cast;
 use libc;
 use prelude::*;