about summary refs log tree commit diff
path: root/src/libcollections/string.rs
AgeCommit message (Collapse)AuthorLines
2017-06-13Merge crate `collections` into `alloc`Murarth-2289/+0
2017-05-20Correct some stability versionsOliver Middleton-7/+7
These were found by running tidy on stable versions of rust and finding features stabilised with the wrong version numbers.
2017-04-28FromIterator and Extend Cow for StringEh2406-0/+18
2017-04-26Auto merge of #41258 - clarcharr:str_box_extras, r=Kimundibors-2/+3
More methods for str boxes. (reduce Box<[u8]> ↔ Box<str> transmutes) This is a follow-up to #41096 that adds safer methods for converting between `Box<str>` and `Box<[u8]>`. They're gated under a different feature from the `&mut str` methods because they may be too niche to include in public APIs, although having them internally helps reduce the number of transmutes the standard library uses. What's added: * `From<Box<str>> for Box<[u8]>` * `<Box<str>>::into_boxed_bytes` (just calls `Into::into`) * `alloc::str` (new module) * `from_boxed_utf8` and `from_boxed_utf8_unchecked`, defined in `alloc:str`, exported in `collections::str` * exports `from_utf8_mut` in `collections::str` (missed from previous PR)
2017-04-24More methods for str boxes.Clar Charr-2/+3
2017-04-23Use Vec::splice impl in string::Splice::drop()Matt Ickstadt-15/+1
2017-04-23Improve splice docs and testsMatt Ickstadt-2/+2
2017-04-23Update splice implMatt Ickstadt-2/+11
2017-04-23Add Vec::splice and String::spliceSimon Sapin-1/+129
2017-04-14refactor: add reason stringEvgeny Safronov-1/+1
2017-04-14fix: add feature to doc testsEvgeny Safronov-0/+1
2017-04-14Add `as_bytes()` for `FromUtf8Error`.Evgeny Safronov-0/+19
This change allows to obtain an underlying invalid UTF-8 bytes without `FromUtf8Error` destruction. Such method may be useful for example in a library that attempts to save both valid and invalid UTF-8 strings in some struct and to be able to provide immutable access to it without destruction.
2017-04-09Reduce str transmutes, add mut versions of methods.Clar Charr-2/+2
2017-03-17Rollup merge of #40456 - frewsxcv:frewsxcv-docs-function-parens, ↵Corey Farwell-47/+47
r=GuillaumeGomez Remove function invokation parens from documentation links. This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-13Remove function invokation parens from documentation links.Corey Farwell-47/+47
This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-10Add From<Box<..>> implementations.Clar Charr-0/+16
2017-03-05Issue #39688 - Help people find String::as_bytes() for UTF-8 r? @steveklabnikJoshua Horwitz-0/+8
2017-03-03Auto merge of #40189 - SimonSapin:one-width, r=alexcrichtonbors-2/+2
Reduce std_unicode’s public API * Only keep one copy of the `UTF8_CHAR_WIDTH` table instead of one of each of libcore and libstd_unicode. * Move the `utf8_char_width` function to `core::str` under the `str_internals` unstable feature. * Remove `std_unicode::str::is_utf16`. It was only accessible through the `#[unstable]` crate std_unicode. It has never been used in the compiler or standard library since 47e7a05 added it in 2012 “for OS API interop”. It can be replaced with a one-liner: ```rust fn is_utf16(slice: &[u16]) -> bool { std::char::decode_utf16(s).all(|r| r.is_ok()) } ```
2017-03-02Rollup merge of #40117 - SimonSapin:to-err-is-for-the-formatter, r=alexcrichtonCorey Farwell-1/+8
Panic on errors in `format!` or `<T: Display>::to_string` … instead of silently ignoring a result. `fmt::Write for String` never returns `Err`, so implementations of `Display` (or other traits of that family) never should either. Fixes #40103
2017-03-01Panic on errors in `format!` or `<T: Display>::to_string`Simon Sapin-1/+8
… instead of silently ignoring a result. `fmt::Write for String` never returns `Err`, so implementations of `Display` (or other traits of that family) never should either. Fixes #40103
2017-03-01Only keep one copy of the UTF8_CHAR_WIDTH table.Simon Sapin-2/+2
… instead of one of each of libcore and libstd_unicode. Move the `utf8_char_width` function to `core::str` under the `str_internals` unstable feature.
2017-02-28Rollup merge of #40028 - withoutboats:string_from_iter, r=alexcrichtonCorey Farwell-0/+9
impl FromIterator<&char> for String
2017-02-26Auto merge of #39738 - keeperofdakeys:vec-docs, r=GuillaumeGomezbors-0/+3
Add notes about capacity effects to Vec::truncate() Add notes about the effects of Vec::truncate() and Vec::clear() on the capacity of a vector.
2017-02-24Rollup merge of #39886 - mbrubeck:doc-edit, r=steveklabnikGuillaume Gomez-0/+42
Additional docs for Vec, String, and slice trait impls r? @steveklabnik
2017-02-22impl FromIter<&char> for StringWithout Boats-0/+9
2017-02-16Fixup String::split_off documentationSteven Allen-9/+9
1. Clarify that `String::split_off` returns one string and modifies self in-place. The documentation implied that it returns two new strings. 2. Make the documentation mirror `Vec::split_off`.
2017-02-16Additional docs for Vec, String, and slice trait implsMatt Brubeck-0/+42
2017-02-14Add notes about capacity effects to Vec::truncate()Josh-0/+3
2017-02-07Auto merge of #39002 - GuillaumeGomez:debug_libcollections, r=aturonbors-0/+7
Add Debug implementations for libcollection structs Part of #31869.
2017-02-05Replace PlaceBack Debug implementation with deriveGuillaume Gomez-2/+2
2017-02-01std: Add ToString trait specialization for Cow<'a, str> and Stringf001-0/+16
r? @bluss
2017-01-25std: Stabilize APIs for the 1.16.0 releaseAlex Crichton-7/+2
This commit applies the stabilization/deprecations of the 1.16.0 release, as tracked by the rust-lang/rust issue tracker and the final-comment-period tag. The following APIs were stabilized: * `VecDeque::truncate` * `VecDeque::resize` * `String::insert_str` * `Duration::checked_{add,sub,div,mul}` * `str::replacen` * `SocketAddr::is_ipv{4,6}` * `IpAddr::is_ipv{4,6}` * `str::repeat` * `Vec::dedup_by` * `Vec::dedup_by_key` * `Result::unwrap_or_default` * `<*const T>::wrapping_offset` * `<*mut T>::wrapping_offset` * `CommandExt::creation_flags` (on Windows) * `File::set_permissions` * `String::split_off` The following APIs were deprecated * `EnumSet` - replaced with other ecosystem abstractions, long since unstable Closes #27788 Closes #35553 Closes #35774 Closes #36436 Closes #36949 Closes #37079 Closes #37087 Closes #37516 Closes #37827 Closes #37916 Closes #37966 Closes #38080
2017-01-20Add Debug implementations for libcollection structsGuillaume Gomez-0/+7
2017-01-14have RangeArgument return a Bound<&T> from each of its methodsdjzin-2/+11
2016-12-20run rustfmt on libcollections folderSrinivas Reddy Thatiparthy-7/+3
2016-12-12Auto merge of #38049 - frewsxcv:libunicode, r=alexcrichtonbors-2/+2
Rename 'librustc_unicode' crate to 'libstd_unicode'. Fixes https://github.com/rust-lang/rust/issues/26554.
2016-12-03Remove redundant assertion near is_char_boundary.Clar Charr-4/+0
2016-11-30Add String::split_off.Clar Charr-0/+33
2016-11-30Rename 'librustc_unicode' crate to 'libstd_unicode'.Corey Farwell-2/+2
Fixes #26554.
2016-11-04Change Into<Vec<u8>> for String and Into<OsString> for PathBuf to From implsleonardo.yvens-4/+4
2016-10-22Auto merge of #37327 - aidanhs:aphs-bytes-iter-doc, r=alexcrichtonbors-2/+2
`as_bytes` is not the iterator on String, `bytes` is r? @steveklabnik
2016-10-21`as_bytes` is not the iterator, `bytes` isAidan Hobson Sayers-2/+2
2016-10-21Implement `From<Cow<str>> for String` and `From<Cow<[T]>> for Vec<T>`.Simon Sapin-0/+7
Motivation: the `selectors` crate is generic over a string type, in order to support all of `String`, `string_cache::Atom`, and `gecko_string_cache::Atom`. Multiple trait bounds are used for the various operations done with these strings. One of these operations is creating a string (as efficiently as possible, re-using an existing memory allocation if possible) from `Cow<str>`. The `std::convert::From` trait seems natural for this, but the relevant implementation was missing before this PR. To work around this I’ve added a `FromCowStr` trait in `selectors`, but with trait coherence that means one of `selectors` or `string_cache` needs to depend on the other to implement this trait. Using a trait from `std` would solve this. The `Vec<T>` implementation is just added for consistency. I also tried a more general `impl<'a, O, B: ?Sized + ToOwned<Owned=O>> From<Cow<'a, B>> for O`, but (the compiler thinks?) it conflicts with `From<T> for T` the impl (after moving all of `collections::borrow` into `core::borrow` to work around trait coherence).
2016-10-10Add missing urls on String moduleGuillaume Gomez-3/+4
2016-09-30Rollup merge of #36623 - GuillaumeGomez:doc_typos, r=steveklabnikSteve Klabnik-3/+3
Fix some typos and improve doc comments style r? @steveklabnik
2016-09-28[breaking-change] std: change `encode_utf{8,16}()` to take a buffer and ↵tormol-3/+4
return a slice They panic if the buffer is too small.
2016-09-24Fix some typos and improve doc comments styleGuillaume Gomez-3/+3
2016-09-23Revert "implement `From<Vec<char>>` and `From<&'a [char]>` for `String`"Brian Anderson-20/+0
This reverts commit ac73335f2f5421c914fa3900567696cc6dc73d8d.
2016-09-11Documentation of what does for each typeathulappadan-0/+1
2016-08-23Auto merge of #35656 - Stebalien:fused, r=alexcrichtonbors-1/+4
Implement 1581 (FusedIterator) * [ ] Implement on patterns. See https://github.com/rust-lang/rust/issues/27721#issuecomment-239638642. * [ ] Handle OS Iterators. A bunch of iterators (`Args`, `Env`, etc.) in libstd wrap platform specific iterators. The current ones all appear to be well-behaved but can we assume that future ones will be? * [ ] Does someone want to audit this? On first glance, all of the iterators on which I implemented `FusedIterator` appear to be well-behaved but there are a *lot* of them so a second pair of eyes would be nice. * I haven't touched rustc internal iterators (or the internal rand) because rustc doesn't actually call `fuse()`. * `FusedIterator` can't be implemented on `std::io::{Bytes, Chars}`. Closes: #35602 (Tracking Issue) Implements: rust-lang/rfcs#1581