diff options
| author | Matt Brubeck <mbrubeck@limpet.net> | 2017-02-16 09:18:18 -0800 |
|---|---|---|
| committer | Matt Brubeck <mbrubeck@limpet.net> | 2017-02-16 12:12:17 -0800 |
| commit | b2ac1c9c6b595f39c79e13bc4e0a0411441c7543 (patch) | |
| tree | e93c36b7b1bba33c14ec04cbc4a72bc6e17aaca0 /src/libcore | |
| parent | ccd96c945fb5d3a0841e0f9469d27f1fc8142edd (diff) | |
| download | rust-b2ac1c9c6b595f39c79e13bc4e0a0411441c7543.tar.gz rust-b2ac1c9c6b595f39c79e13bc4e0a0411441c7543.zip | |
Additional docs for Vec, String, and slice trait impls
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/slice.rs | 2 | ||||
| -rw-r--r-- | src/libcore/str/mod.rs | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 3e0b8425573..0331c5d4ba4 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -2202,6 +2202,7 @@ impl<A, B> PartialEq<[B]> for [A] where A: PartialEq<B> { #[stable(feature = "rust1", since = "1.0.0")] impl<T: Eq> Eq for [T] {} +/// Implements comparison of vectors lexicographically. #[stable(feature = "rust1", since = "1.0.0")] impl<T: Ord> Ord for [T] { fn cmp(&self, other: &[T]) -> Ordering { @@ -2209,6 +2210,7 @@ impl<T: Ord> Ord for [T] { } } +/// Implements comparison of vectors lexicographically. #[stable(feature = "rust1", since = "1.0.0")] impl<T: PartialOrd> PartialOrd for [T] { fn partial_cmp(&self, other: &[T]) -> Option<Ordering> { diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 49a6b1b5fce..925cd84154a 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -1366,6 +1366,13 @@ mod traits { use ops; use str::eq_slice; + /// Implements ordering of strings. + /// + /// Strings are ordered lexicographically by their byte values. This orders Unicode code + /// points based on their positions in the code charts. This is not necessarily the same as + /// "alphabetical" order, which varies by language and locale. Sorting strings according to + /// culturally-accepted standards requires locale-specific data that is outside the scope of + /// the `str` type. #[stable(feature = "rust1", since = "1.0.0")] impl Ord for str { #[inline] @@ -1387,6 +1394,13 @@ mod traits { #[stable(feature = "rust1", since = "1.0.0")] impl Eq for str {} + /// Implements comparison operations on strings. + /// + /// Strings are compared lexicographically by their byte values. This compares Unicode code + /// points based on their positions in the code charts. This is not necessarily the same as + /// "alphabetical" order, which varies by language and locale. Comparing strings according to + /// culturally-accepted standards requires locale-specific data that is outside the scope of + /// the `str` type. #[stable(feature = "rust1", since = "1.0.0")] impl PartialOrd for str { #[inline] |
