about summary refs log tree commit diff
path: root/src/libcollections/str.rs
AgeCommit message (Collapse)AuthorLines
2017-06-13Merge crate `collections` into `alloc`Murarth-1997/+0
2017-06-11Add missing term 'disjoint' from matches, rmatchesCampbell Barton-2/+2
This follows `match_indices`
2017-05-26Rollup merge of #42236 - citizen428:docs/unchecked-indexing-slicing, ↵Corey Farwell-0/+11
r=GuillaumeGomez Update documentation for indexing/slicing methods See #39911 r? @steveklabnik
2017-05-26Update documentation for indexing/slicing methodsMichael Kohl-0/+11
See #39911
2017-05-24Remove superfluous `;;` sequencesDan Callahan-1/+1
2017-05-19Try to optimise char patternsSimonas Kazlauskas-0/+14
2017-05-12Remove some unused macros from the rust codebaseest31-12/+0
Removes unused macros from: * libcore * libcollections The last use of these two macros was removed in commit b64c9d56700e2c41207166fe8709711ff02488ff when the char_range_at_reverse function was been removed. * librustc_errors Their last use was removed by commits 2f2c3e178325dc1837badcd7573c2c0905fab979 and 11dc974a38fd533aa692cea213305056cd3a6902. * libsyntax_ext * librustc_trans Also, put the otry macro in back/msvc/mod.rs under the same cfg argument as the places that use it.
2017-04-24More methods for str boxes.Clar Charr-1/+10
2017-04-13Auto merge of #41009 - scottmcm:toowned-clone-into, r=alexcrichtonbors-0/+6
Add a resource-reusing method to `ToOwned` `ToOwned::to_owned` generalizes `Clone::clone`, but `ToOwned` doesn't have an equivalent to `Clone::clone_from`. This PR adds such a method as `clone_into` under a new unstable feature `toowned_clone_into`. Analogous to `clone_from`, this has the obvious default implementation in terms of `to_owned`. I've updated the `libcollections` impls: for `T:Clone` it uses `clone_from`, for `[T]` I moved the code from `Vec::clone_from` and implemented that in terms of this, and for `str` it's a predictable implementation in terms of `[u8]`. Used it in `Cow::clone_from` to reuse resources when both are `Cow::Owned`, and added a test that `Cow<str>` thus keeps capacity in `clone_from` in that situation. The obvious question: is this the right place for the method? - It's here so it lives next to `to_owned`, making the default implementation reasonable, and avoiding another trait. But allowing method syntax forces a name like `clone_into`, rather than something more consistent like `owned_from`. - Another trait would allow `owned_from` and could support multiple owning types per borrow type. But it'd be another single-method trait that generalizes `Clone`, and I don't know how to give it a default impl in terms of `ToOwned::to_owned`, since a blanket would mean overlapping impls problems. I did it this way as it's simpler and many of the `Borrow`s/`AsRef`s don't make sense with `owned_from` anyway (`[T;1]:Borrow<[T]>`, `Arc<T>:Borrow<T>`, `String:AsRef<OsStr>`...). I'd be happy to re-do it the other way, though, if someone has a good solution for the default handling. (I can also update with `CStr`, `OsStr`, and `Path` once a direction is decided.)
2017-04-12Add ToOwned::clone_into (unstable as toowned_clone_into)Scott McMurray-0/+6
to_owned generalizes clone; this generalizes clone_from. Use to_owned to give it a default impl. Customize the impl for [T], str, and T:Clone. Use it in Cow::clone_from to reuse resources when cloning Owned into Owned.
2017-04-12Rollup merge of #41243 - projektir:prim_str_docs, r=GuillaumeGomezTim Neumann-13/+24
Minor nits in primitive str Some minor updates to linking, added some links, doc format, etc. r? @GuillaumeGomez
2017-04-12Minor nits in primitive strprojektir-13/+24
2017-04-09Reduce str transmutes, add mut versions of methods.Clar Charr-1/+8
2017-03-31Rollup merge of #40935 - donniebishop:str_boilerplate_docs, r=steveklabnikCorey Farwell-2/+8
Modify str Structs descriptions References #29375. Modified descriptions of multiple structs to be more in line with structs found under [`std::iter`](https://doc.rust-lang.org/std/iter/#structs), such as [`Chain`](https://doc.rust-lang.org/std/iter/struct.Chain.html) and [`Enumerate`](https://doc.rust-lang.org/std/iter/struct.Enumerate.html)
2017-03-31Auto merge of #40737 - nagisa:safe-slicing-strs, r=BurntSushibors-1/+109
Checked slicing for strings cc https://github.com/rust-lang/rust/issues/39932
2017-03-30Remove parentheses in method referencesDonnie Bishop-2/+2
2017-03-30Modify EncodeUtf16's descriptionDonnie Bishop-2/+8
2017-03-28Rollup merge of #40682 - TigleyM:str_doc, r=steveklabnikCorey Farwell-1/+20
Update docs for std::str fixes #29375 I noticed there are docs for the `str` primitive type, which contained extensive examples, so my additions give a more general explanation of `&str`. But please let me know if something can be explained more or changed. r? @steveklabnik
2017-03-27Review request changesMicah Tigley-3/+3
2017-03-22Tracking issue numbersSimonas Kazlauskas-4/+4
2017-03-22Checked (and unchecked) slicing for strings?Simonas Kazlauskas-1/+109
What is this magic‽
2017-03-22Various fixes to wording consistency in the docsStjepan Glavina-1/+1
2017-03-20Fix Rust linting errorMicah Tigley-4/+5
2017-03-20Move str docs to proper place in file.Micah Tigley-22/+19
2017-03-20Update docs for std::strMicah Tigley-0/+21
2017-03-13Remove function invokation parens from documentation links.Corey Farwell-34/+34
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-08Document why `str.to_{lower,upper}case` return `String`Tobias Bucher-0/+8
Fixes #39201.
2017-02-07Auto merge of #39002 - GuillaumeGomez:debug_libcollections, r=aturonbors-0/+8
Add Debug implementations for libcollection structs Part of #31869.
2017-02-05Replace PlaceBack Debug implementation with deriveGuillaume Gomez-1/+1
2017-01-25std: Stabilize APIs for the 1.16.0 releaseAlex Crichton-8/+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/+8
2016-12-20run rustfmt on libcollections folderSrinivas Reddy Thatiparthy-5/+1
2016-11-30Rename 'librustc_unicode' crate to 'libstd_unicode'.Corey Farwell-4/+4
Fixes #26554.
2016-10-11Rollup merge of #36699 - bluss:repeat-str, r=alexcrichtonGuillaume Gomez-0/+20
Add method str::repeat(self, usize) -> String It is relatively simple to repeat a string n times: `(0..n).map(|_| s).collect::<String>()`. It becomes slightly more complicated to do it “right” (sizing the allocation up front), which warrants a method that does it for us. This method is useful in writing testcases, or when generating text. `format!()` can be used to repeat single characters, but not repeating strings like this.
2016-10-11Add method str::repeat(self, usize) -> StringUlrik Sverdrup-0/+20
It is relatively simple to repeat a string n times: `(0..n).map(|_| s).collect::<String>()`. It becomes slightly more complicated to do it “right” (sizing the allocation up front), which warrants a method that does it for us. This method is useful in writing testcases, or when generating text. `format!()` can be used to repeat single characters, but not repeating strings like this.
2016-10-06Rollup merge of #36930 - angelsl:issue-36202, r=frewsxcvJonathan Turner-10/+10
Clarify last element in str.{r,}splitn documentation An attempt at #36202. I'm not sure if my wording is actually clearer, to be honest...
2016-10-06Clarify last element in str.{r,}splitn documentationangelsl-10/+10
2016-10-01std: Correct stability attributes for some implementationsOliver Middleton-1/+1
These are displayed by rustdoc so should be correct.
2016-09-24Fix some typos and improve doc comments styleGuillaume Gomez-2/+2
2016-09-13Implement std::str::replacenknight42-0/+43
2016-08-18Add a FusedIterator trait.Steven Allen-0/+4
This trait can be used to avoid the overhead of a fuse wrapper when an iterator is already well-behaved. Conforming to: RFC 1581 Closes: #35602
2016-07-28Rename `char::escape` to `char::escape_debug` and add tracking issueTobias Bucher-3/+3
2016-07-26Restore `char::escape_default` and add `char::escape` insteadTobias Bucher-0/+8
2016-06-23std: Fix up stabilization discrepanciesAlex Crichton-1/+1
* Remove the deprecated `CharRange` type which was forgotten to be removed awhile back. * Stabilize the `os::$platform::raw::pthread_t` type which was intended to be stabilized as part of #32804
2016-06-07Rollup merge of #33645 - withoutboats:woboats_trim_matches_doc, r=steveklabnikSteve Klabnik-2/+2
Correct the docs on str::trim_matches This pattern cannot be a str because str's pattern is not double-ended.
2016-05-30std: Clean out old unstable + deprecated APIsAlex Crichton-239/+0
These should all have been deprecated for at least one cycle, so this commit cleans them all out.
2016-05-27Added examples/docs to split in str.rsTy Coghlan-2/+28
Added documentation clarifying the behavior of split when used with the empty string and contiguous separators.
2016-05-14Correct the docs on str::trim_matchesWithout Boats-2/+2
This pattern cannot be a str because str's pattern is not double-ended.
2016-04-14fix str::split_at_mut() exampleGigih Aji Ibrahim-2/+2
2016-04-11std: Stabilize APIs for the 1.9 releaseAlex Crichton-8/+21
This commit applies all stabilizations, renamings, and deprecations that the library team has decided on for the upcoming 1.9 release. All tracking issues have gone through a cycle-long "final comment period" and the specific APIs stabilized/deprecated are: Stable * `std::panic` * `std::panic::catch_unwind` (renamed from `recover`) * `std::panic::resume_unwind` (renamed from `propagate`) * `std::panic::AssertUnwindSafe` (renamed from `AssertRecoverSafe`) * `std::panic::UnwindSafe` (renamed from `RecoverSafe`) * `str::is_char_boundary` * `<*const T>::as_ref` * `<*mut T>::as_ref` * `<*mut T>::as_mut` * `AsciiExt::make_ascii_uppercase` * `AsciiExt::make_ascii_lowercase` * `char::decode_utf16` * `char::DecodeUtf16` * `char::DecodeUtf16Error` * `char::DecodeUtf16Error::unpaired_surrogate` * `BTreeSet::take` * `BTreeSet::replace` * `BTreeSet::get` * `HashSet::take` * `HashSet::replace` * `HashSet::get` * `OsString::with_capacity` * `OsString::clear` * `OsString::capacity` * `OsString::reserve` * `OsString::reserve_exact` * `OsStr::is_empty` * `OsStr::len` * `std::os::unix::thread` * `RawPthread` * `JoinHandleExt` * `JoinHandleExt::as_pthread_t` * `JoinHandleExt::into_pthread_t` * `HashSet::hasher` * `HashMap::hasher` * `CommandExt::exec` * `File::try_clone` * `SocketAddr::set_ip` * `SocketAddr::set_port` * `SocketAddrV4::set_ip` * `SocketAddrV4::set_port` * `SocketAddrV6::set_ip` * `SocketAddrV6::set_port` * `SocketAddrV6::set_flowinfo` * `SocketAddrV6::set_scope_id` * `<[T]>::copy_from_slice` * `ptr::read_volatile` * `ptr::write_volatile` * The `#[deprecated]` attribute * `OpenOptions::create_new` Deprecated * `std::raw::Slice` - use raw parts of `slice` module instead * `std::raw::Repr` - use raw parts of `slice` module instead * `str::char_range_at` - use slicing plus `chars()` plus `len_utf8` * `str::char_range_at_reverse` - use slicing plus `chars().rev()` plus `len_utf8` * `str::char_at` - use slicing plus `chars()` * `str::char_at_reverse` - use slicing plus `chars().rev()` * `str::slice_shift_char` - use `chars()` plus `Chars::as_str` * `CommandExt::session_leader` - use `before_exec` instead. Closes #27719 cc #27751 (deprecating the `Slice` bits) Closes #27754 Closes #27780 Closes #27809 Closes #27811 Closes #27830 Closes #28050 Closes #29453 Closes #29791 Closes #29935 Closes #30014 Closes #30752 Closes #31262 cc #31398 (still need to deal with `before_exec`) Closes #31405 Closes #31572 Closes #31755 Closes #31756