about summary refs log tree commit diff
path: root/src/libstd/sys/common/mod.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-01-24 19:39:52 +0000
committerbors <bors@rust-lang.org>2015-01-24 19:39:52 +0000
commitbb7cc4eb26e87ec4cb2acdc5bc3a7d25b9c817be (patch)
tree04338cf8bf55a8510cd6ab0771698e320beb13e8 /src/libstd/sys/common/mod.rs
parent76fbb3583174ca8856b4e149929839888f503e6b (diff)
parentc5369ebc7f4791c4e291951751b8964052c7a523 (diff)
downloadrust-bb7cc4eb26e87ec4cb2acdc5bc3a7d25b9c817be.tar.gz
rust-bb7cc4eb26e87ec4cb2acdc5bc3a7d25b9c817be.zip
Auto merge of #21488 - aturon:os-str, r=alexcrichton
Per [RFC 517](https://github.com/rust-lang/rfcs/pull/575/), this commit introduces platform-native strings. The API is essentially as described in the RFC.

The WTF-8 implementation is adapted from @SimonSapin's [implementation](https://github.com/SimonSapin/rust-wtf8). To make this work, some encodign and decoding functionality in `libcore` is now exported in a "raw" fashion reusable for WTF-8. These exports are *not* reexported in `std`, nor are they stable.
Diffstat (limited to 'src/libstd/sys/common/mod.rs')
-rw-r--r--src/libstd/sys/common/mod.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/libstd/sys/common/mod.rs b/src/libstd/sys/common/mod.rs
index a31dcc9884f..272cf9bd0c0 100644
--- a/src/libstd/sys/common/mod.rs
+++ b/src/libstd/sys/common/mod.rs
@@ -29,6 +29,7 @@ pub mod stack;
 pub mod thread;
 pub mod thread_info;
 pub mod thread_local;
+pub mod wtf8;
 
 // common error constructors
 
@@ -93,11 +94,21 @@ pub fn keep_going<F>(data: &[u8], mut f: F) -> i64 where
     return (origamt - amt) as i64;
 }
 
-// A trait for extracting representations from std::io types
-pub trait AsInner<Inner> {
+/// A trait for viewing representations from std types
+pub trait AsInner<Inner: ?Sized> {
     fn as_inner(&self) -> &Inner;
 }
 
+/// A trait for extracting representations from std types
+pub trait IntoInner<Inner> {
+    fn into_inner(self) -> Inner;
+}
+
+/// A trait for creating std types from internal representations
+pub trait FromInner<Inner> {
+    fn from_inner(inner: Inner) -> Self;
+}
+
 pub trait ProcessConfig<K: BytesContainer, V: BytesContainer> {
     fn program(&self) -> &CString;
     fn args(&self) -> &[CString];