diff options
| author | bors <bors@rust-lang.org> | 2015-02-14 10:03:01 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-02-14 10:03:01 +0000 |
| commit | df54632601ee01b1ff0e608d9e33fc865c1f2598 (patch) | |
| tree | 3844c1930d2417ed1d1ed8abdf2d27251c289321 /src/libstd/sys/common | |
| parent | 95b228ab95902cf7bfa025ca918b42d94053df84 (diff) | |
| parent | 4175f1ce2fa57ca466e94aa59de9b9383f3c05a4 (diff) | |
| download | rust-df54632601ee01b1ff0e608d9e33fc865c1f2598.tar.gz rust-df54632601ee01b1ff0e608d9e33fc865c1f2598.zip | |
Auto merge of #22119 - aturon:new-process, r=alexcrichton
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::*; |
