1
Fork 0

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
This commit is contained in:
Marvin Löbel 2013-09-14 19:37:45 +02:00
parent 3e1803f3af
commit 76c3e8a38c
9 changed files with 406 additions and 16 deletions

View file

@ -121,6 +121,7 @@ pub mod str;
#[path = "str/ascii.rs"]
pub mod ascii;
pub mod send_str;
pub mod ptr;
pub mod owned;