about summary refs log tree commit diff
path: root/src/libstd/std.rs
diff options
context:
space:
mode:
authorMarvin Löbel <loebel.marvin@gmail.com>2013-09-14 19:37:45 +0200
committerMarvin Löbel <loebel.marvin@gmail.com>2013-09-16 16:57:50 +0200
commit76c3e8a38cea2fe6342d83158c267e57a6b1f53f (patch)
treedb7c6ca84a3e769ed40343411ecf43f369883418 /src/libstd/std.rs
parent3e1803f3af1adc1b2e5595650f6920f40bbedc2e (diff)
downloadrust-76c3e8a38cea2fe6342d83158c267e57a6b1f53f.tar.gz
rust-76c3e8a38cea2fe6342d83158c267e57a6b1f53f.zip
Add an SendStr type
A SendStr is a string that can hold either a ~str or a &'static str.
This can be useful as an optimization when an allocation is sometimes needed but the common case is statically known.

Possible use cases include Maps with both static and owned keys, or propagating error messages across task boundaries.

SendStr implements most basic traits in a way that hides the fact that it is an enum; in particular things like order and equality are only determined by the content of the wrapped strings.

Replaced std::rt:logging::SendableString with SendStr
Added tests for using an SendStr as key in Hash- and Treemaps
Diffstat (limited to 'src/libstd/std.rs')
-rw-r--r--src/libstd/std.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libstd/std.rs b/src/libstd/std.rs
index d78ea9f0093..05433c47059 100644
--- a/src/libstd/std.rs
+++ b/src/libstd/std.rs
@@ -121,6 +121,7 @@ pub mod str;
 
 #[path = "str/ascii.rs"]
 pub mod ascii;
+pub mod send_str;
 
 pub mod ptr;
 pub mod owned;