about summary refs log tree commit diff
path: root/src/liballoc/string.rs
AgeCommit message (Collapse)AuthorLines
2019-03-09Use lifetime contravariance to elide more lifetimes in core+alloc+stdScott McMurray-2/+2
2019-02-13Add a convert::Infallible empty enum, make string::ParseError an aliasSimon Sapin-34/+3
2019-02-10libs: doc commentsAlexander Regueiro-4/+2
2019-02-03liballoc: revert nested imports style changes.Mazdak Farrokhzad-24/+14
2019-02-02liballoc: fix some idiom lints.Mazdak Farrokhzad-8/+8
2019-02-02liballoc: elide some lifetimes.Mazdak Farrokhzad-10/+10
2019-02-02liballoc: prefer imports of borrow from libcore.Mazdak Farrokhzad-1/+1
2019-02-02liballoc: adjust abolute imports + more import fixes.Mazdak Farrokhzad-1/+1
2019-02-02liballoc: refactor & fix some imports.Mazdak Farrokhzad-15/+24
2019-02-02liballoc: cargo check passes on 2018Mazdak Farrokhzad-5/+5
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-09Fix typoBeatButton-1/+1
2018-12-06Rollup merge of #56548 - Lucretiel:string-extend-optimize, r=sfacklerPietro Albini-18/+29
Optimized string FromIterator + Extend impls I noticed that there was a lost opportunity to reuse string buffers in `FromIterator<String>` and `FromIterator<Cow<str>>`; updated the implementations to use these. In practice this translates to at least one fewer allocation when using these APIs. Additionally, rewrote `Extend` implementations to use `iter.for_each`, which (supposedly) helps the compiler optimize those loops (because iterator adapters are encouraged to provide optimized implementations of `fold` and `try_fold`.
2018-12-05Added explainatory commentsNathan West-0/+6
2018-12-05Fixed mutabilityNathan West-4/+4
2018-12-05Optimized string FromIterator implsNathan West-18/+23
2018-12-04cleanup: remove static lifetimes from constsljedrz-1/+1
2018-12-02Update issue number of `shrink_to` methods to point the tracking issueHidehito Yabuuchi-1/+1
2018-11-21String: add a FIXME to from_utf16ljedrz-0/+2
2018-11-15Rollup merge of #55530 - ljedrz:speed_up_String_from_utf16, r=SimonSapinPietro Albini-1/+9
Speed up String::from_utf16 Collecting into a `Result` is idiomatic, but not necessarily fast due to rustc not being able to preallocate for the resulting collection. This is fine in case of an error, but IMO we should optimize for the common case, i.e. a successful conversion. This changes the behavior of `String::from_utf16` from collecting into a `Result` to pushing to a preallocated `String` in a loop. According to [my simple benchmark](https://gist.github.com/ljedrz/953a3fb74058806519bd4d640d6f65ae) this change makes `String::from_utf16` around **twice** as fast.
2018-11-11Minor style guide corrections.Denis Vasilik-6/+6
2018-11-11Whitespace cleanup according to Rust's style guidelines.Denis Vasilik-3/+3
2018-11-11Added comments for trait implementations.Denis Vasilik-1/+28
2018-11-11Added comment for From trait implementation: boxed string slice to StringDenis Vasilik-0/+14
2018-11-07Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwcokennytm-1/+1
refactor: use shorthand fields refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-06refactor: use shorthand fieldsteresy-1/+1
2018-10-31Speed up String::from_utf16ljedrz-1/+9
2018-10-27Update string.rsHsiang-Cheng Yang-1/+1
remove unused variable i in example String::with_capacity()
2018-09-27liballoc: mark str.to_owned() and String::from(&str) as #[inline].Matthias Krüger-0/+1
Fixes #53681
2018-09-06Fix invalid urlsGuillaume Gomez-3/+1
2018-08-22docs: std::string::String.repeat(): slightly rephrase to be more in-line ↵Matthias Krüger-3/+3
with other descriptions. add ticks around a few keywords in other descriptions.
2018-08-20Replace usages of ptr::offset with ptr::{add,sub}.Corey Farwell-7/+7
2018-08-11Add links to std::char::REPLACEMENT_CHARACTER from docs.Corey Farwell-2/+4
There are a few places where we mention the replacement character in the docs, and it could be helpful for users to utilize the constant which is available in the standard library, so let’s link to it!
2018-07-22Rollup merge of #51807 - newpavlov:deprecate_str_slice, r=alexcrichtonkennytm-1/+1
Deprecation of str::slice_unchecked(_mut) Closes #51715 I am not sure if 1.28.0 or 1.29.0 should be used for deprecation version, for now it's 1.28.0. Additionally I've replaced `slice_unchecked` uses with `get_unchecked`. The only places where this method is still used are `src/liballoc/tests/str.rs` and `src/liballoc/tests/str.rs`.
2018-06-29Move core::alloc::CollectionAllocErr to alloc::collectionsSimon Sapin-1/+1
2018-06-26Deprecation of str::slice_uncheked(_mut)newpavlov-1/+1
2018-05-24stabilize RangeBounds collections_range #30877Cory Sherman-4/+4
rename RangeBounds::start() -> start_bound() rename RangeBounds::end() -> end_bound()
2018-05-17Rollup merge of #50170 - burtonageo:more_cow_from, r=alexcrichtonkennytm-0/+8
Implement From for more types on Cow This is basically https://github.com/rust-lang/rust/pull/48191, except that it should be implemented in a way that doesn't break third party crates.
2018-05-09Update features to 1.28.0George Burton-1/+1
2018-05-05make `String::new()` constF001-1/+2
2018-04-27Update the stable attributes to use the current nightly version numberGeorge Burton-1/+1
2018-04-22Implement From for more types on CowGeorge Burton-0/+8
2018-04-17Remove no longer necessary comparison to Vec::splice.Corey Farwell-3/+0
`String::replace_range` was previously called `String::splice`, so this note was necessary to differentiate it from the `Vec` method. Now that it's renamed, this note no longer seems necessary.
2018-04-17Rollup merge of #49555 - nox:inline-into-boxed, r=alexcrichtonkennytm-0/+1
Inline most of the code paths for conversions with boxed slices This helps with the specific problem described in #49541, obviously without making any large change to how inlining works in the general case. Everything involved in the conversions is made `#[inline]`, except for the `<Vec<T>>::into_boxed_slice` entry point which is made `#[inline(always)]` after checking that duplicating the function mentioned in the issue prevented its inlining if I only annotate it with `#[inline]`. For the record, that function was: ```rust pub fn foo() -> Box<[u8]> { vec![0].into_boxed_slice() } ``` To help the inliner's job, we also hoist a `self.capacity() != self.len` check in `<Vec<T>>::shrink_to_fit` and mark it as `#[inline]` too.
2018-04-14Cleanup liballoc use statementsMike Hommey-2/+2
Some modules were still using the deprecated `allocator` module, use the `alloc` module instead. Some modules were using `super` while it's not needed. Some modules were more or less ordering them, and other not, so the latter have been modified to match the others.
2018-04-12Reexport from core::unicode::char in core::char rather than vice versaSimon Sapin-1/+1
2018-04-12Deprecate the std_unicode crateSimon Sapin-1/+1
2018-04-12Move Utf8Lossy decoder to libcoreSimon Sapin-1/+1
2018-04-01Stabilize String::replace_rangeThayne McCombs-6/+5
Fixes #44643
2018-04-01Inline most of the code paths for conversions with boxed slicesAnthony Ramine-0/+1
This helps with the specific problem described in #49541, obviously without making any large change to how inlining works in the general case. Everything involved in the conversions is made `#[inline]`, except for the `<Vec<T>>::into_boxed_slice` entry point which is made `#[inline(always)]` after checking that duplicating the function mentioned in the issue prevented its inlining if I only annotate it with `#[inline]`. For the record, that function was: ```rust pub fn foo() -> Box<[u8]> { vec![0].into_boxed_slice() } ``` To help the inliner's job, we also hoist a `self.capacity() != self.len` check in `<Vec<T>>::shrink_to_fit` and mark it as `#[inline]` too.