summary refs log tree commit diff
path: root/src/libcollections/string.rs
AgeCommit message (Collapse)AuthorLines
2015-07-27Show appropriate feature flags in docsSteve Klabnik-2/+3
2015-07-20Register new snapshotsAlex Crichton-3/+0
These new snapshots contain the knowledge of how to build the new triples of 32-bit MSVC and 32-bit FreeBSD, both of which should soon start having nightlies/auto builders! This does not currently register bitrig/freebsd snapshots but I believe those will be retroactively added in the near future.
2015-07-17Add RawVec to unify raw Vecish codeAlexis Beingessner-44/+1
2015-07-13Implement IndexMut for String and str.Simon Sapin-0/+32
... matching the existing Index impls. There is no reason not to if String implement DerefMut. The code removed in `src/librustc/middle/effect.rs` was added in #9750 to prevent things like `s[0] = 0x80` where `s: String`, but I belive became unnecessary when the Index(Mut) traits were introduced.
2015-07-13Implement DerefMut for StringSimon Sapin-0/+8
`&mut str` is rarely useful, but it is for e.g. `AsciiExt::make_ascii_lowercase`.
2015-07-11Add String::into_boxed_slice and Box<str>::into_stringJonathan Reem-0/+11
Implements merged RFC 1152. Closes #26697.
2015-07-02Add more description for from_raw_parts's unsafetySteve Klabnik-2/+7
Fixes #26737.
2015-06-17collections: Split the `collections` featureAlex Crichton-6/+13
This commit also deprecates the `as_string` and `as_slice` free functions in the `string` and `vec` modules.
2015-06-10Modify String::push to reallocate more conservatively in case of the ↵marcell-17/+17
character's UTF-8 representation is bigger than 1 byte
2015-06-08Auto merge of #26077 - SimonSapin:patch-6, r=alexcrichtonbors-5/+5
With the latter is provided by the `From` conversion trait, the former is now completely redundant. Their code is identical. Let’s deprecate now and plan to remove in the next cycle. (It’s `#[unstable]`.) r? @alexcrichton CC @nagisa
2015-06-08Auto merge of #25989 - jooert:implement_rfc839, r=Gankrobors-0/+7
I had to use `impl<'a, V: Copy> Extend<(usize, &'a V)> for VecMap<V>` instead of `impl<'a, V: Copy> Extend<(&'a usize, &'a V)> for VecMap<V>` as that's what is needed for doing ```rust let mut a = VecMap::new(); let b = VecMap::new(); b.insert(1, "foo"); a.extend(&b) ``` I can squash the commits after review. r? @Gankro
2015-06-08Replace usage of String::from_str with String:fromSimon Sapin-3/+3
2015-06-08Implement RFC 839Johannes Oertel-0/+7
Closes #25976.
2015-06-07Deprecate String::from_str in favor of String::fromSimon Sapin-2/+2
With the latter is provided by the `From` conversion trait, the former is now completely redundant. Their code is identical.
2015-06-06Remove many unneeded feature annotations in the docsSteve Klabnik-1/+1
When things get stabilized, they don't always have their docs updated to remove the gate.
2015-06-01doc: make String::as_bytes example more simpleTshepang Lekhonkhobe-2/+1
2015-05-19collections: Avoid unstable code in examples for StringUlrik Sverdrup-21/+9
Prefer String::from over from_str; String::from_str is unstable while String::from is stable. Promote the latter by using it in examples. Simply migrating unstable function to the closest alternative.
2015-05-16Fixed reserve_exact exampleMário Feroldi-1/+1
The same example for ``reverse`` were in the ``reserve_exact``'s example.
2015-05-10Rollup merge of #25158 - koute:master, r=alexcrichtonSteve Klabnik-0/+1
I was profiling my code again and this time AsRef<str> for String was eating up a considerable chunk of my runtime; adding the inline annotation made the program run almost twice as fast! While I was at it I also added the annotation to other implementations of AsRef as well as AsMut.
2015-05-10Add #[inline] to AsRef<str>::as_ref for String and str.Jan Bujak-0/+1
2015-05-08collections: impl AsRef<[u8]> for StringSean McArthur-0/+8
2015-05-04Fix spelling errors in documentation.Joseph Crail-1/+1
2015-05-02Auto merge of #25028 - bluss:drain-string, r=alexcrichtonbors-1/+107
collections: Implement String::drain(range) according to RFC 574 `.drain(range)` is unstable and under feature(collections_drain). This adds a safe way to remove any range of a String as efficiently as possible. As noted in the code, this drain iterator has none of the memory safety issues of the vector version. RFC tracking issue is #23055
2015-05-01collections: Implement String::drain(range) according to RFC 574Ulrik Sverdrup-1/+107
`.drain(range)` is unstable and under feature(collections_drain). This adds a safe way to remove any range of a String as efficiently as possible. As noted in the code, this drain iterator has none of the memory safety issues of the vector version. RFC tracking issue is #23055
2015-05-01std: Remove index notation on slice iteratorsAlex Crichton-9/+12
These implementations were intended to be unstable, but currently the stability attributes cannot handle a stable trait with an unstable `impl` block. This commit also audits the rest of the standard library for explicitly-`#[unstable]` impl blocks. No others were removed but some annotations were changed to `#[stable]` as they're defacto stable anyway. One particularly interesting `impl` marked `#[stable]` as part of this commit is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly clones all elements of the vector provided. Closes #24791
2015-04-27collections: Improve example for as_string and as_vecUlrik Sverdrup-4/+5
2015-04-21Test fixes and rebase conflicts, round 1Alex Crichton-1/+0
2015-04-21rollup merge of #24636: alexcrichton/remove-deprecatedAlex Crichton-17/+0
Conflicts: src/libcore/result.rs
2015-04-21rollup merge of #24541: alexcrichton/issue-24538Alex Crichton-2/+2
This is an implementation of [RFC 1030][rfc] which adds these traits to the prelude and additionally removes all inherent `into_iter` methods on collections in favor of the trait implementation (which is now accessible by default). [rfc]: https://github.com/rust-lang/rfcs/pull/1030 This is technically a breaking change due to the prelude additions and removal of inherent methods, but it is expected that essentially no code breaks in practice. [breaking-change] Closes #24538
2015-04-21rollup merge of #24661: SimonSapin/fmt-write-charAlex Crichton-0/+6
as accepted in [RFC 526](https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md). Note that this brand new method is marked as **stable**. I judged this safe enough: it’s simple enough that it’s very unlikely to change. Still, I can mark it unstable instead if you prefer. r? @alexcrichton
2015-04-21std: Remove deprecated/unstable num functionalityAlex Crichton-8/+0
This commit removes all the old casting/generic traits from `std::num` that are no longer in use by the standard library. This additionally removes the old `strconv` module which has not seen much use in quite a long time. All generic functionality has been supplanted with traits in the `num` crate and the `strconv` module is supplanted with the [rust-strconv crate][rust-strconv]. [rust-strconv]: https://github.com/lifthrasiir/rust-strconv This is a breaking change due to the removal of these deprecated crates, and the alternative crates are listed above. [breaking-change]
2015-04-21std: Remove deprecated AsOsStr/Str/AsSlice traitsAlex Crichton-9/+0
Cleaning out more deprecated items
2015-04-21Auto merge of #24620 - pczarn:model-lexer-issues, r=cmrbors-2/+0
Fixes #15679 Fixes #15878 Fixes #15882 Closes #15883
2015-04-21Add a `write_char` method to `std::fmt::Write`Simon Sapin-0/+6
as accepted in [RFC 526](https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md).
2015-04-21Model lexer: Fix remaining issuesPiotr Czarnecki-2/+0
2015-04-19collections: Move optimized String::from_str to String::fromErick Tryzelaar-1/+12
This implementation is currently about 3-4 times faster than using the `.to_string()` based approach.
2015-04-17std: Add Default/IntoIterator/ToOwned to the preludeAlex Crichton-2/+2
This is an implementation of [RFC 1030][rfc] which adds these traits to the prelude and additionally removes all inherent `into_iter` methods on collections in favor of the trait implementation (which is now accessible by default). [rfc]: https://github.com/rust-lang/rfcs/pull/1030 This is technically a breaking change due to the prelude additions and removal of inherent methods, but it is expected that essentially no code breaks in practice. [breaking-change] Closes #24538
2015-04-16deprecate Unicode functions that will be moved to crates.iokwantam-2/+2
This patch 1. renames libunicode to librustc_unicode, 2. deprecates several pieces of libunicode (see below), and 3. removes references to deprecated functions from librustc_driver and libsyntax. This may change pretty-printed output from these modules in cases involving wide or combining characters used in filenames, identifiers, etc. The following functions are marked deprecated: 1. char.width() and str.width(): --> use unicode-width crate 2. str.graphemes() and str.grapheme_indices(): --> use unicode-segmentation crate 3. str.nfd_chars(), str.nfkd_chars(), str.nfc_chars(), str.nfkc_chars(), char.compose(), char.decompose_canonical(), char.decompose_compatible(), char.canonical_combining_class(): --> use unicode-normalization crate
2015-04-14rollup merge of #24377: apasel422/docsAlex Crichton-7/+7
Conflicts: src/libstd/net/ip.rs src/libstd/sys/unix/fs.rs src/libstd/sys/unix/mod.rs src/libstd/sys/windows/mod.rs
2015-04-13pluralize doc comment verbs and add missing periodsAndrew Paseltiner-7/+7
2015-04-10std: Stabilize the Utf8Error typeAlex Crichton-10/+6
The meaning of each variant of this enum was somewhat ambiguous and it's uncler that we wouldn't even want to add more enumeration values in the future. As a result this error has been altered to instead become an opaque structure. Learning about the "first invalid byte index" is still an unstable feature, but the type itself is now stable.
2015-04-07Auto merge of #23952 - Kimundi:more_string_pattern, r=alexcrichtonbors-1/+1
This adds the missing methods and turns `str::pattern` in a user facing module, as per RFC. This also contains some big internal refactorings: - string iterator pairs are implemented with a central macro to reduce redundancy - Moved all tests from `coretest::str` into `collectionstest::str` and left a note to prevent the two sets of tests drifting apart further. See https://github.com/rust-lang/rust/issues/22477
2015-04-05Refactored core::str::pattern to become a user-facing module and hide awayMarvin Löbel-1/+1
CharEq.
2015-04-02Implement PartialEq<str> for String and CowGleb Kozyrev-0/+2
2015-04-02Change PartialEq impls in collections::string to slice notationGleb Kozyrev-10/+10
2015-04-01Collect the definition of the `Error` trait into `libstd` for now. ThisNiko Matsakis-11/+0
sidesteps a coherence difficulty where `liballoc` had to prove that `&str: !Error`, which didn't involve any local types.
2015-03-31rollup merge of #23873: alexcrichton/remove-deprecatedAlex Crichton-5/+0
Conflicts: src/libcollectionstest/fmt.rs src/libcollectionstest/lib.rs src/libcollectionstest/str.rs src/libcore/error.rs src/libstd/fs.rs src/libstd/io/cursor.rs src/libstd/os.rs src/libstd/process.rs src/libtest/lib.rs src/test/run-pass-fulldeps/compiler-calls.rs
2015-03-31rollup merge of #23875: aturon/revise-convert-2Alex Crichton-1/+8
* Marks `#[stable]` the contents of the `std::convert` module. * Added methods `PathBuf::as_path`, `OsString::as_os_str`, `String::as_str`, `Vec::{as_slice, as_mut_slice}`. * Deprecates `OsStr::from_str` in favor of a new, stable, and more general `OsStr::new`. * Adds unstable methods `OsString::from_bytes` and `OsStr::{to_bytes, to_cstring}` for ergonomic FFI usage. [breaking-change] r? @alexcrichton
2015-03-31std: Clean out #[deprecated] APIsAlex Crichton-5/+0
This commit cleans out a large amount of deprecated APIs from the standard library and some of the facade crates as well, updating all users in the compiler and in tests as it goes along.
2015-03-31rollup merge of #23886: demelev/remove_as_slice_usageAlex Crichton-1/+1