about summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
2015-06-09Auto merge of #26065 - Marwes:master, r=alexcrichtonbors-673/+674
PR for #26052 with the new order as written below. ``` //Querying fn len(&self) -> usize fn is_empty(&self) -> bool fn width(&self, is_cjk: bool) -> usize fn is_char_boundary(&self, index: usize) -> bool //Slicing and char retrieval fn as_bytes(&self) -> &[u8] fn as_ptr(&self) -> *const u8 unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str fn slice_chars(&self, begin: usize, end: usize) -> &str fn char_range_at(&self, start: usize) -> CharRange fn char_range_at_reverse(&self, start: usize) -> CharRange fn char_at(&self, i: usize) -> char fn char_at_reverse(&self, i: usize) -> char fn slice_shift_char(&self) -> Option<(char, &str)> //Iterators fn chars(&self) -> Chars fn char_indices(&self) -> CharIndices fn bytes(&self) -> Bytes fn split_whitespace(&self) -> SplitWhitespace fn words(&self) -> Words fn lines(&self) -> Lines fn lines_any(&self) -> LinesAny fn nfd_chars(&self) -> Decompositions fn nfkd_chars(&self) -> Decompositions fn nfc_chars(&self) -> Recompositions fn nfkc_chars(&self) -> Recompositions fn graphemes(&self, is_extended: bool) -> Graphemes fn grapheme_indices(&self, is_extended: bool) -> GraphemeIndices fn utf16_units(&self) -> Utf16Units //Searching fn contains<'a, P>(&'a self, pat: P) -> bool where P: Pattern<'a> fn starts_with<'a, P>(&'a self, pat: P) -> bool where P: Pattern<'a> fn ends_with<'a, P>(&'a self, pat: P) -> bool where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> fn find<'a, P>(&'a self, pat: P) -> Option<usize> where P: Pattern<'a> fn rfind<'a, P>(&'a self, pat: P) -> Option<usize> where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> fn split<'a, P>(&'a self, pat: P) -> Split<'a, P> where P: Pattern<'a> fn rsplit<'a, P>(&'a self, pat: P) -> RSplit<'a, P> where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> fn split_terminator<'a, P>(&'a self, pat: P) -> SplitTerminator<'a, P> where P: Pattern<'a> fn rsplit_terminator<'a, P>(&'a self, pat: P) -> RSplitTerminator<'a, P> where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> fn splitn<'a, P>(&'a self, count: usize, pat: P) -> SplitN<'a, P> where P: Pattern<'a> fn rsplitn<'a, P>(&'a self, count: usize, pat: P) -> RSplitN<'a, P> where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> fn matches<'a, P>(&'a self, pat: P) -> Matches<'a, P> where P: Pattern<'a> fn rmatches<'a, P>(&'a self, pat: P) -> RMatches<'a, P> where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> fn match_indices<'a, P>(&'a self, pat: P) -> MatchIndices<'a, P> where P: Pattern<'a> fn rmatch_indices<'a, P>(&'a self, pat: P) -> RMatchIndices<'a, P> where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> fn subslice_offset(&self, inner: &str) -> usize //Trim fn trim(&self) -> &str fn trim_left(&self) -> &str fn trim_right(&self) -> &str fn trim_matches<'a, P>(&'a self, pat: P) -> &'a str where P: Pattern<'a>, P::Searcher: DoubleEndedSearcher<'a> fn trim_left_matches<'a, P>(&'a self, pat: P) -> &'a str where P: Pattern<'a> fn trim_right_matches<'a, P>(&'a self, pat: P) -> &'a str where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> //Conversion fn parse<F>(&self) -> Result<F, F::Err> where F: FromStr fn replace(&self, from: &str, to: &str) -> String fn to_lowercase(&self) -> String fn to_uppercase(&self) -> String fn escape_default(&self) -> String fn escape_unicode(&self) -> String ```
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-08Reordered the methods on str to improve doc sortingMarkus Westerlind-673/+674
2015-06-08Address a review comment and fix a bootstrapping issueSimon Sapin-2/+7
2015-06-08Auto merge of #25989 - jooert:implement_rfc839, r=Gankrobors-0/+77
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/+77
Closes #25976.
2015-06-08Auto merge of #25823 - oli-obk:static_to_const_lint, r=alexcrichtonbors-5/+5
r? @eddyb
2015-06-07Auto merge of #25912 - tshepang:better-str-examples, r=blussbors-50/+28
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-07doc: improve some of str examplesTshepang Lekhonkhobe-50/+28
2015-06-07change some statics to constantsOliver 'ker' Schneider-5/+5
2015-06-07Auto merge of #26066 - steveklabnik:docs_on_a_plane, r=alexcrichtonbors-2/+2
When things get stabilized, they don't always have their docs updated to remove the gate.
2015-06-06Remove many unneeded feature annotations in the docsSteve Klabnik-2/+2
When things get stabilized, they don't always have their docs updated to remove the gate.
2015-06-06Auto merge of #26050 - bluss:linked-list, r=Gankrobors-83/+132
The recent bug that was found in LinkedList reminded me of some general cleanup that's been waiting for some time. - Use a loop from the front in Drop, it works just as well and without an unsafe block - Change Rawlink methods to use `unsafe` in an idiomatic way. This does mean that we need an unsafe block for each dereference of a raw link. Even then, the extent of unsafe-critical code is even larger of course, since safety depends on the whole data structure's integrity. This is a general problem we are aware of. - Some cleanup just to try to decrease the amount of Rawlink handling.
2015-06-06Mark str::to_uppercase and str::to_lowercase as stable.Simon Sapin-2/+2
2015-06-06linked_list: Add Rawlink::fromUlrik Sverdrup-12/+14
2015-06-06linked_list: Add method Node::set_nextUlrik Sverdrup-11/+20
2015-06-06linked_list: Cleanup code in split_offUlrik Sverdrup-13/+37
2015-06-06linked_list: Use unsafe properly for Rawlink methodsUlrik Sverdrup-48/+70
2015-06-06linked_list: Use a safe loop in DropUlrik Sverdrup-11/+3
2015-06-06Correctly map upper-case Sigma to lower-case in word-final position. Fix #26035.Simon Sapin-1/+25
2015-06-05Auto merge of #26024 - Aatch:inline-as_bytes, r=Gankrobors-0/+1
This wasn't marked inline, so wasn't being inlined cross-crate. It's actually a no-op function, since it's a wrapper around `mem::transmute`. Marking it inline means that programs calling it can see that it's a no-op and act accordingly during optimisation.
2015-06-05Mark std::as_bytes as inlineJames Miller-0/+1
This wasn't marked inline, so wasn't being inlined cross-crate. It's actually a no-op function, since it's a wrapper around `mem::transmute`. Marking it inline means that programs calling it can see that it's a no-op and act accordingly during optimisation.
2015-06-04properly null out ptr in LinkedList::split_off - fixes #26020Alexis Beingessner-0/+26
2015-06-04Auto merge of #25991 - Jexell:master, r=alexcrichtonbors-5/+3
Removed an unnecessary `transmute` and replaced some code with an equivalent method.
2015-06-03Update linked_list.rsJexell-5/+3
Removed an unnecessary `transmute` and replaced some code with an equivalent method.
2015-06-03Auto merge of #25935 - wesleywiser:fix_libcollection_build_warnings, ↵bors-4/+11
r=alexcrichton Fixes a bunch of warnings that are generated during the stage0 build of libcollections.
2015-06-02Rollup merge of #25936 - tshepang:patch-2, r=alexcrichtonManish Goregaokar-2/+1
2015-06-01[libcollections] Fix unused import warnings during stage0 buildWesley Wiser-4/+11
2015-06-01doc: make String::as_bytes example more simpleTshepang Lekhonkhobe-2/+1
2015-05-30doc: be more clear/explicit that we got String typeTshepang Lekhonkhobe-1/+1
2015-05-29Auto merge of #25838 - mbrubeck:doc-edit, r=steveklabnikbors-1/+5
Fixes #25622. r? @steveklabnik
2015-05-28Auto merge of #25856 - bluss:binary-heap-hole, r=Gankrobors-25/+88
collections: Make BinaryHeap panic safe in sift_up / sift_down Use a struct called Hole that keeps track of an invalid location in the vector and fills the hole on drop. I include a run-pass test that the current BinaryHeap fails, and the new one passes. NOTE: The BinaryHeap will still be inconsistent after a comparison fails. It will not have the heap property. What we fix is just that elements will be valid values. This is actually a performance win -- the new code does not bother to write in `zeroed()` values in the holes, it just leaves them as they were. Net result is something like a 5% decrease in runtime for `BinaryHeap::from_vec`. This can be further improved by using unchecked indexing (I confirmed it makes a difference, not a surprise with the non-sequential access going on), but let's leave that for another PR. Safety first :wink: Fixes #25842
2015-05-28collections: Make BinaryHeap panic safe in sift_up / sift_downUlrik Sverdrup-25/+88
Use a struct called Hole that keeps track of an invalid location in the vector and fills the hole on drop. I include a run-pass test that the current BinaryHeap fails, and the new one passes. Fixes #25842
2015-05-28remove references to IoResultSteve Klabnik-2/+2
This is now std::io::Result
2015-05-27Improve docs for Vec::as_slice and as_mut_sliceMatt Brubeck-1/+5
Fixes #25622.
2015-05-27Remove #[cfg(stage0)] items.Eduard Burtescu-145/+2
2015-05-23Rollup merge of #25716 - steveklabnik:remove_bad_docs, r=GankroOliver Schneider-3/+2
2015-05-23Rollup merge of #25714 - brianquinlan:patch-1, r=huonwOliver Schneider-1/+2
2015-05-23Auto merge of #24847 - sfackler:debug-builders-stability, r=aturonbors-1/+0
The `debug_builders` feature is up for 1.1 stabilization in #24028. This commit stabilizes the API as-is with no changes. Some nits that @alexcrichton mentioned that may be worth discussing now if anyone cares: * Should `debug_tuple_struct` and `DebugTupleStruct` be used instead of `debug_tuple` and `DebugTuple`? It's more typing but is a technically more correct name. * `DebugStruct` and `DebugTuple` have `field` methods while `DebugSet`, `DebugMap` and `DebugList` have `entry` methods. Should we switch those to something else for consistency? cc @alexcrichton @aturon
2015-05-22Don't mention outdated methodsSteve Klabnik-3/+2
2015-05-22Make it clear that push is only amortized O(1)Brian Quinlan-1/+2
2015-05-20Auto merge of #25625 - bluss:doc-slice-order, r=Gankrobors-434/+434
collections: Reorder slice methods to improve API docs We have an evolutionary history whose traces are still visible in the slice docs today. Some heuristics: * Group method and method_mut together * Group method and method_by together * Group by use case, here we have roughly: Basic interrogators (len) Mutation (swap) Iterators (iter) Segmentation (split) Searching (contains) Permutations (permutations) Misc (clone_from_slice)
2015-05-20collections: Reorder slice methods to improve API docsUlrik Sverdrup-434/+434
We have an evolutionary history whose traces are still visible in the slice docs today. Some heuristics: * Group method and method_mut together * Group method and method_by together * Group by use case, here we have roughly: Basic interrogators (len) Mutation (swap) Iterators (iter) Segmentation (split) Searching (contains) Permutations (permutations) Misc (clone_from_slice)
2015-05-20Auto merge of #25588 - bluss:doc-string-from, r=alexcrichtonbors-62/+20
Use stable code in doc examples (libcollections) Main task is to change from String::from_str to String::from in examples for String (the latter constructor is stable). While I'm at it, also remove redundant feature flags, fix some other instances of unstable code in examples (in examples for stable methods), and remove some use of usize in examples too.
2015-05-19Stabilize debug builders for 1.2.0Steven Fackler-1/+0
2015-05-19Small fix for https://github.com/rust-lang/rust/pull/25611Steve Klabnik-0/+4
2015-05-19Rollup merge of #25611 - parir:patch-1, r=steveklabnikSteve Klabnik-0/+4
r? @steveklabnik
2015-05-19doc: add missing fencesparir-0/+4