diff options
| author | bors <bors@rust-lang.org> | 2014-05-13 18:31:51 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-05-13 18:31:51 -0700 |
| commit | b2b383cab5959b1ec331e1d77583fa944b7fd593 (patch) | |
| tree | 79540b4f5f7e125a260b9ca00f25e796241425f9 /src/libstd/str.rs | |
| parent | cb115ac2d4f57d8b590c8d46d8f9e2958ed9a527 (diff) | |
| parent | f09592a5d154177f0c9d739c9fe60742ec4cd951 (diff) | |
auto merge of #14187 : alexcrichton/rust/rollup, r=alexcrichton
Closes #14184 (std: Move the owned module from core to std) Closes #14183 (Allow blocks in const expressions) Closes #14176 (Add tests for from_bits.) Closes #14175 (Replaced ~T by Box<T> in manual) Closes #14173 (Implements Default trait for BigInt and BigUint) Closes #14171 (Fix #8391) Closes #14159 (Clean up unicode code in libstd) Closes #14126 (docs: Add a not found page) Closes #14123 (add a line to the example to clarify semantics) Closes #14106 (Pretty printer improvements) Closes #14083 (rustllvm: Add LLVMRustArrayType) Closes #13957 (io: Implement process wait timeouts)
Diffstat (limited to 'src/libstd/str.rs')
| -rw-r--r-- | src/libstd/str.rs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 24cf9681ca8..fa4cf8e4427 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -228,25 +228,25 @@ fn canonical_sort(comb: &mut [(char, u8)]) { } #[deriving(Clone)] -enum NormalizationForm { - NFD, - NFKD +enum DecompositionType { + Canonical, + Compatible } -/// External iterator for a string's normalization's characters. +/// External iterator for a string's decomposition's characters. /// Use with the `std::iter` module. #[deriving(Clone)] -pub struct Normalizations<'a> { - kind: NormalizationForm, +pub struct Decompositions<'a> { + kind: DecompositionType, iter: Chars<'a>, buffer: Vec<(char, u8)>, sorted: bool } -impl<'a> Iterator<char> for Normalizations<'a> { +impl<'a> Iterator<char> for Decompositions<'a> { #[inline] fn next(&mut self) -> Option<char> { - use unicode::decompose::canonical_combining_class; + use unicode::normalization::canonical_combining_class; match self.buffer.as_slice().head() { Some(&(c, 0)) => { @@ -262,8 +262,8 @@ impl<'a> Iterator<char> for Normalizations<'a> { } let decomposer = match self.kind { - NFD => char::decompose_canonical, - NFKD => char::decompose_compatible + Canonical => char::decompose_canonical, + Compatible => char::decompose_compatible }; if !self.sorted { @@ -887,24 +887,24 @@ pub trait StrAllocating: Str { /// An Iterator over the string in Unicode Normalization Form D /// (canonical decomposition). #[inline] - fn nfd_chars<'a>(&'a self) -> Normalizations<'a> { - Normalizations { + fn nfd_chars<'a>(&'a self) -> Decompositions<'a> { + Decompositions { iter: self.as_slice().chars(), buffer: Vec::new(), sorted: false, - kind: NFD + kind: Canonical } } /// An Iterator over the string in Unicode Normalization Form KD /// (compatibility decomposition). #[inline] - fn nfkd_chars<'a>(&'a self) -> Normalizations<'a> { - Normalizations { + fn nfkd_chars<'a>(&'a self) -> Decompositions<'a> { + Decompositions { iter: self.as_slice().chars(), buffer: Vec::new(), sorted: false, - kind: NFKD + kind: Compatible } } } |
