summary refs log tree commit diff
path: root/src/libstd/prelude.rs
AgeCommit message (Collapse)AuthorLines
2013-09-25std: Replace CloneableTuple with Tuple, which takes self by-val.Huon Wilson-4/+4
The old behaviour of `foo.n0()` is replaced by `foo.n0_ref().clone()`.
2013-09-16Add an SendStr typeMarvin Löbel-0/+1
A SendStr is a string that can hold either a ~str or a &'static str. This can be useful as an optimization when an allocation is sometimes needed but the common case is statically known. Possible use cases include Maps with both static and owned keys, or propagating error messages across task boundaries. SendStr implements most basic traits in a way that hides the fact that it is an enum; in particular things like order and equality are only determined by the content of the wrapped strings. Replaced std::rt:logging::SendableString with SendStr Added tests for using an SendStr as key in Hash- and Treemaps
2013-09-09rename `std::iterator` to `std::iter`Daniel Micay-4/+4
The trait will keep the `Iterator` naming, but a more concise module name makes using the free functions less verbose. The module will define iterables in addition to iterators, as it deals with iteration in general.
2013-09-05Add a from_str function that calls out to the associated method on the traitCorey Richardson-0/+1
2013-09-01std::iterator: Use ExactSize, inheriting DoubleEndedIteratorblake2-ppc-1/+1
Address discussion with acrichto; inherit DoubleEndedIterator so that `.rposition()` can be a default method, and that the nische of the trait is clear. Use assertions when using `.size_hint()` in reverse enumerate and `.rposition()`
2013-08-30std: Implement .rposition() on double-ended iterators with known sizeblake2-ppc-1/+1
This is a generalization of the vector .rposition() method, to all double-ended iterators that have the ExactSizeHint trait. This resolves the slight asymmetry around `position` and `rposition` * position from front is `vec.iter().position()` * position from the back was, `vec.rposition()` is now `vec.iter().rposition()` Additionally, other indexed sequences (only `extra::ringbuf` I think), will have the same method available once it implements ExactSizeHint.
2013-08-29Remove the iter module.Jason Fager-1/+1
Moves the Times trait to num while the question of whether it should exist at all gets hashed out as a completely separate question.
2013-08-26Add a Default trait.Corey Richardson-0/+1
2013-08-20enable tests for the container tutorialDaniel Micay-3/+3
2013-08-20iterator: add a method for reversing a containerDaniel Micay-2/+2
this works on any container with a mutable double-ended iterator
2013-08-20rm obsolete integer to_str{,_radix} free functionsDaniel Micay-1/+1
2013-08-15tuple: remove obsolete ExtendedTupleOpsDaniel Micay-1/+1
replaced by iterators (generic composable `map` and `zip` adaptors)
2013-08-12auto merge of #8400 : blake2-ppc/rust/seq-ord, r=cmrbors-0/+1
Use Eq + Ord for lexicographical ordering of sequences. For each of <, <=, >= or > as R, use:: [x, ..xs] R [y, ..ys] = if x != y { x R y } else { xs R ys } Previous code using `a < b` and then `!(b < a)` for short-circuiting fails on cases such as [1.0, 2.0] < [0.0/0.0, 3.0], where the first element was effectively considered equal. Containers like &[T] did also implement only one comparison operator `<`, and derived the comparison results from this. This isn't correct either for Ord. Implement functions in `std::iterator::order::{lt,le,gt,ge,equal,cmp}` that all iterable containers can use for lexical order. We also visit tuple ordering, having the same problem and same solution (but differing implementation).
2013-08-11add intrinsics for checked overflow add/sub/mulDaniel Micay-1/+1
2013-08-10std: merge Iterator and IteratorUtilErick Tryzelaar-1/+1
2013-08-10std: merge iterator::DoubleEndedIterator and DoubleEndedIteratorUtilErick Tryzelaar-1/+1
2013-08-08std: Implement traits for the one-tupleblake2-ppc-0/+1
(A,) did not have the trait implementations of 2- to 12- tuples.
2013-08-07Merge remote-tracking branch 'remotes/origin/master' into ↵Erick Tryzelaar-1/+2
remove-str-trailing-nulls
2013-08-06add Extendable to the preludeDaniel Micay-1/+2
2013-08-04std: replace str::as_c_str with std::c_strErick Tryzelaar-0/+1
2013-08-04std: remove str::NullTerminatedStrErick Tryzelaar-1/+1
2013-08-02replace `range` with an external iteratorDaniel Micay-1/+2
2013-07-23std: move StrUtil::as_c_str into StrSliceErick Tryzelaar-1/+1
2013-07-17librustc: Remove all uses of the `Copy` bound.Patrick Walton-1/+1
2013-07-13Split mutable methods out of Set and MapSteven Fackler-1/+1
Fixes most of #4989. I didn't add Persistent{Set,Map} since the only persistent data structure is fun_treemap and its functionality is currently too limited to build a trait out of.
2013-07-12extend the iterator tutorialDaniel Micay-2/+3
documents conversion, size hints and double-ended iterators and adds more of the traits to the prelude
2013-07-04Remove standalone comparison functions in vec, make the trait impls better.Huon Wilson-1/+1
2013-07-03auto merge of #7474 : Seldaek/rust/clean-iter, r=thestingerbors-1/+1
I think it's WIP - but I wanted to ask for feedback (/cc @thestinger) I had to move the impl of FromIter for vec into extra::iter because I don't think std can depend on extra, but that's a bit messed up. Similarly some FromIter uses are gone now, not sure if this is fixable or if I made a complete mess here..
2013-07-01Move most iter functionality to extra, fixes #7343Jordi Boggiano-1/+1
2013-06-30Convert vec::dedup to a method.Huon Wilson-1/+1
2013-06-30Convert vec::{bsearch, bsearch_elem} to methods.Huon Wilson-1/+1
2013-06-28librustc: Change "Owned" to "Send" everywherePatrick Walton-1/+1
2013-06-28librustc: Rename Const to FreezePatrick Walton-1/+1
2013-06-28librustc: Change Const to Freeze in the compilerPatrick Walton-1/+2
2013-06-24remove old_iterDaniel Micay-2/+0
the `test/run-pass/class-trait-bounded-param.rs` test was xfailed and written in an ancient dialect of Rust so I've just removed it this also removes `to_vec` from DList because it's provided by `std::iter::to_vec` an Iterator implementation is added for OptVec but some transitional internal iterator methods are still left
2013-06-17Improved std::asciiMarvin Löbel-1/+1
- Fixed tests - Added methods - Renamed casting methods to be shorter closes #7150
2013-06-15rm CopyableOrderedIterDaniel Micay-2/+2
replaced with OrdIterator
2013-06-14rm CopyableNonstrictIterDaniel Micay-1/+1
copies can just be done explicitly: `xs.transform(|x|x.clone())`
2013-06-14rm MutableIterDaniel Micay-1/+1
replaced with mutable implementations of Iterator
2013-06-14rm ExtendedMutableIterDaniel Micay-1/+0
replaced with `xs.mut_iter().enumerate()`
2013-06-14add IteratorUtil to the preludeDaniel Micay-2/+1
2013-06-13std: make all strings Equiv-alent to each other, generalise Path.push_many ↵Huon Wilson-1/+1
to take any type of string.
2013-06-12std: unify the str -> [u8] functions as 3 methods: .as_bytes() and ↵Huon Wilson-1/+1
.as_bytes_with_null[_consume](). The first acts on &str and is not nul-terminated, the last two act on strings that are always null terminated (&'static str, ~str and @str).
2013-06-07add the Iterator trait to the preludeDaniel Micay-0/+1
2013-06-08std: remove each[i]_mut functions, in favour of iterators.Huon Wilson-1/+0
2013-06-06FixupsMarvin Löbel-2/+3
2013-06-03auto merge of #6907 : steveklabnik/rust/prelude_docs, r=graydonbors-1/+18
2013-06-03Add better documentation for the Prelude.Steve Klabnik-1/+18
2013-06-03rename the Ptr trait to RawPtrDaniel Micay-1/+1
Closes #6607
2013-06-03Add traits for concat and connect methodsBrendan Zabarauskas-2/+2