summary refs log tree commit diff
path: root/src/liballoc/str.rs
AgeCommit message (Collapse)AuthorLines
2017-11-14Fixed several pulldown warnings when documenting libstd.kennytm-1/+1
2017-11-08get() example should use get() not get_mut()John Ford-4/+4
I'm really new to Rust, this is the first thing I've ever actually pushed to github in a rust project, so please double check that it's correct. I noticed that the in-doc example for the string's get() function was referring to get_mut(). Looks like a copy/paste issue. ```rust fn main() { let v = String::from("🗻∈🌏"); assert_eq!(Some("🗻"), v.get(0..4)); // indices not on UTF-8 sequence boundaries assert!(v.get(1..).is_none()); assert!(v.get(..8).is_none()); // out of bounds assert!(v.get(..42).is_none()); } ``` results in: ``` jhford-work:~/rust/redish $ cat get-example.rs fn main() { let v = String::from("🗻∈🌏"); assert_eq!(Some("🗻"), v.get(0..4)); // indices not on UTF-8 sequence boundaries assert!(v.get(1..).is_none()); assert!(v.get(..8).is_none()); // out of bounds assert!(v.get(..42).is_none()); } jhford-work:~/rust/redish $ rustc get-example.rs jhford-work:~/rust/redish $ ./get-example ; echo $? 0 ``` I did not build an entire rust toolchain as I'm not totally sure how to do that.
2017-11-03Mark several ascii methods as unstable againLukas Kalbertodt-10/+14
We don't want to stabilize them now already. The goal of this set of commits is just to add inherent methods to the four types. Stabilizing all of those methods can be done later.
2017-11-03Remove unused AsciiExt imports and fix tests related to ascii methodsLukas Kalbertodt-4/+0
Many AsciiExt imports have become useless thanks to the inherent ascii methods added in the last commits. These were removed. In some places, I fully specified the ascii method being called to enforce usage of the AsciiExt trait. Note that some imports are not removed but tagged with a `#[cfg(stage0)]` attribute. This is necessary, because certain ascii methods are not yet available in stage0. All those imports will be removed later. Additionally, failing tests were fixed. The test suite should exit successfully now.
2017-11-03Copy `AsciiExt` methods to `str` directlyLukas Kalbertodt-0/+276
This is done in order to deprecate AsciiExt eventually. Note that this commit contains a bunch of `cfg(stage0)` statements. This is due to a new compiler feature this commit depends on: the `slice_u8` lang item. Once this lang item is available in the stage0 compiler, all those cfg flags (and more) can be removed.
2017-10-17added non trivial examples of closures for str::findChristian Poveda-2/+2
2017-10-17added examples of closuresChristian Poveda-1/+3
2017-09-27Remove mem::transmute used in Box<str> conversionsNikolai Vazquez-5/+3
2017-09-14Rollup merge of #44521 - rwakulszowa:str_utf16_doc, r=frewsxcvCorey Farwell-0/+13
Add an example of std::str::encode_utf16 Closes #44419
2017-09-14Rollup merge of #44497 - tommyip:doc_example, r=frewsxcvCorey Farwell-0/+11
Add doc example to str::from_boxed_utf8_unchecked Fixes #44463.
2017-09-12Add an example of std::str::encode_utf16rwakulszowa-0/+13
Closes #44419
2017-09-11Add doc example to str::from_boxed_utf8_uncheckedTommy Ip-0/+11
Fixes #44463.
2017-09-11Removed trailing whitespace42triangles-1/+1
2017-09-11Added an example for `std::str::into_boxed_bytes()`42triangles-0/+11
2017-09-10Rollup merge of #44467 - toidiu:ak-44382, r=frewsxcvGuillaume Gomez-7/+16
documentation update to demonstrate mutability #44467 - demonstrate correct implementation returns `Some` - demonstrate out of bounds returns `None` - demonstrate mutability
2017-09-09documentation update to demonstrate mutabilitytoidiu-7/+16
2017-09-09Add doc examples for str::as_bytes_mutEthan Dagner-0/+28
Fixes #44427
2017-08-24Fix inconsistent doc headingslukaramu-1/+1
This fixes headings reading "Unsafety" and "Example", they should be "Safety" and "Examples" according to RFC 1574.
2017-08-05Indicate how to turn byte slices back into a string slice.Corey Farwell-2/+9
2017-08-05Update str::split_at_mut example to demonstrate mutability.Corey Farwell-6/+10
2017-08-04Indicate why str::{get,get_mut} examples return None.Corey Farwell-5/+15
2017-07-25std: Stabilize the `str_{mut,box}_extras` featureAlex Crichton-3/+3
Stabilizes * `<&mut str>::as_bytes_mut` * `<Box<str>>::into_boxed_bytes` * `std::str::from_boxed_utf8_unchecked` * `std::str::from_utf8_mut` * `std::str::from_utf8_unchecked_mut` Closes #41119
2017-07-25std: Stabilize `str_checked_slicing` featureAlex Crichton-8/+4
Stabilized * `<str>::get` * `<str>::get_mut` * `<str>::get_unchecked` * `<str>::get_unchecked_mut` Closes #39932
2017-06-13Merge crate `collections` into `alloc`Murarth-1/+1982
2017-04-24More methods for str boxes.Clar Charr-0/+21