diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2016-02-01 11:26:23 -0500 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2016-02-02 00:32:09 -0500 |
| commit | c0ace5dc16511a36fcfc0cf659959d4b0327d4f4 (patch) | |
| tree | f1bdc64ca84f6fca7d85ded2b0d9e1c939e2afbd | |
| parent | 5a5aacac1f6f06fdbff415e74e9f71ebf6443a4d (diff) | |
| download | rust-c0ace5dc16511a36fcfc0cf659959d4b0327d4f4.tar.gz rust-c0ace5dc16511a36fcfc0cf659959d4b0327d4f4.zip | |
Add doctests for directionality
Thanks @nodakai
| -rw-r--r-- | src/libcollections/str.rs | 20 | ||||
| m--------- | src/liblibc | 0 | ||||
| m--------- | src/llvm | 0 |
3 files changed, 20 insertions, 0 deletions
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 03474a45fea..dcba0be4b17 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -1531,6 +1531,16 @@ impl str { /// /// assert_eq!("Hello\tworld\t", s.trim_left()); /// ``` + /// + /// Directionality: + /// + /// ``` + /// let s = " English"; + /// assert!(Some('E') == s.trim_left().chars().next()); + /// + /// let s = " עברית"; + /// assert!(Some('ע') == s.trim_left().chars().next()); + /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn trim_left(&self) -> &str { UnicodeStr::trim_left(self) @@ -1557,6 +1567,16 @@ impl str { /// /// assert_eq!(" Hello\tworld", s.trim_right()); /// ``` + /// + /// Directionality: + /// + /// ``` + /// let s = "English "; + /// assert!(Some('h') == s.trim_right().chars().rev().next()); + /// + /// let s = "עברית "; + /// assert!(Some('ת') == s.trim_right().chars().rev().next()); + /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn trim_right(&self) -> &str { UnicodeStr::trim_right(self) diff --git a/src/liblibc b/src/liblibc -Subproject af77843345ec6fc7e51113bfd692138d89024bc +Subproject 30f70baa6cc1ba3ddebb55b988fafbad0c0cc81 diff --git a/src/llvm b/src/llvm -Subproject 3564439515985dc1cc0d77057ed00901635a80a +Subproject de5c31045dc0f6da1f65d02ee640ccf99ba90e7 |
