diff options
| author | Aaron Turon <aturon@mozilla.com> | 2015-02-06 09:42:57 -0800 |
|---|---|---|
| committer | Aaron Turon <aturon@mozilla.com> | 2015-02-13 23:21:08 -0800 |
| commit | 4175f1ce2fa57ca466e94aa59de9b9383f3c05a4 (patch) | |
| tree | f3eef73ff8e35621235406397244f6ad4e287782 /src/libstd/sys/common | |
| parent | 39b463f15328f448c13fa990f9fc8897e0af55c2 (diff) | |
| download | rust-4175f1ce2fa57ca466e94aa59de9b9383f3c05a4.tar.gz rust-4175f1ce2fa57ca466e94aa59de9b9383f3c05a4.zip | |
Add std::process
Per [RFC 579](https://github.com/rust-lang/rfcs/pull/579), this commit adds a new `std::process` module. This module is largely based on the existing `std::old_io::process` module, but refactors the API to use `OsStr` and other new standards set out by IO reform. The existing module is not yet deprecated, to allow for the new API to get a bit of testing before a mass migration to it.
Diffstat (limited to 'src/libstd/sys/common')
| -rw-r--r-- | src/libstd/sys/common/wtf8.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs index 89200471465..6047f94b3b4 100644 --- a/src/libstd/sys/common/wtf8.rs +++ b/src/libstd/sys/common/wtf8.rs @@ -27,6 +27,7 @@ use core::char::{encode_utf8_raw, encode_utf16_raw}; use core::str::{char_range_at_raw, next_code_point}; use core::raw::Slice as RawSlice; +use ascii::*; use borrow::Cow; use cmp; use fmt; @@ -38,6 +39,7 @@ use ops; use slice; use str; use string::{String, CowString}; +use sys_common::AsInner; use unicode::str::{Utf16Item, utf16_items}; use vec::Vec; @@ -384,6 +386,10 @@ pub struct Wtf8 { bytes: [u8] } +impl AsInner<[u8]> for Wtf8 { + fn as_inner(&self) -> &[u8] { &self.bytes } +} + // FIXME: https://github.com/rust-lang/rust/issues/18805 impl PartialEq for Wtf8 { fn eq(&self, other: &Wtf8) -> bool { self.bytes.eq(&other.bytes) } @@ -811,6 +817,21 @@ impl<'a, S: Writer + Hasher> Hash<S> for Wtf8 { } } +impl AsciiExt<Wtf8Buf> for Wtf8 { + fn is_ascii(&self) -> bool { + self.bytes.is_ascii() + } + fn to_ascii_uppercase(&self) -> Wtf8Buf { + Wtf8Buf { bytes: self.bytes.to_ascii_uppercase() } + } + fn to_ascii_lowercase(&self) -> Wtf8Buf { + Wtf8Buf { bytes: self.bytes.to_ascii_lowercase() } + } + fn eq_ignore_ascii_case(&self, other: &Wtf8) -> bool { + self.bytes.eq_ignore_ascii_case(&other.bytes) + } +} + #[cfg(test)] mod tests { use prelude::v1::*; |
