about summary refs log tree commit diff
path: root/src/libstd/tuple.rs
AgeCommit message (Collapse)AuthorLines
2015-07-20std: Create separate docs for the primitivesBrian Anderson-60/+0
Having the primitive and module docs derived from the same source causes problems, primarily that they can't contain hyperlinks cross-referencing each other. This crates dedicated private modules in `std` to document the primitive types, then for all primitives that have a corresponding module, puts hyperlinks in moth the primitive docs and the module docs cross-linking each other. This should help clear up confusion when readers find themselves on the wrong page.
2015-07-20doc: Clean up primitive short descriptionsBrian Anderson-1/+1
This makes the primitive descriptions on the front page read properly as descriptions of types and not of the associated modules.
2015-06-23tuple.rs: Document more traits implemented by tuples if their components doJosh Triplett-0/+2
Tuples implement Debug and Hash if their components do.
2015-04-22Remove doc-comment default::Default importsCorey Farwell-2/+0
In 8f5b5f94dcdb9884737dfbc8efd893d1d70f0b14, `default::Default` was added to the prelude, so these imports are no longer necessary.
2015-03-05Remove integer suffixes where the types in compiled code are identical.Eduard Burtescu-1/+1
2015-01-30Remove all `i` suffixesTobias Bucher-5/+5
2015-01-23grandfathered -> rust1Brian Anderson-1/+1
2015-01-21Add 'feature' and 'since' to stability attributesBrian Anderson-1/+1
2015-01-05removing whitespaceFakeKane-3/+3
2015-01-05examples added for element accessFakeKane-1/+12
2015-01-05reverting other changesFakeKane-10/+4
2015-01-03Remove deprecated functionalityAlex Crichton-11/+0
This removes a large array of deprecated functionality, regardless of how recently it was deprecated. The purpose of this commit is to clean out the standard libraries and compiler for the upcoming alpha release. Some notable compiler changes were to enable warnings for all now-deprecated command line arguments (previously the deprecated versions were silently accepted) as well as removing deriving(Zero) entirely (the trait was removed). The distribution no longer contains the libtime or libregex_macros crates. Both of these have been deprecated for some time and are available externally.
2015-01-02std: Stabilize the prelude moduleAlex Crichton-3/+3
This commit is an implementation of [RFC 503][rfc] which is a stabilization story for the prelude. Most of the RFC was directly applied, removing reexports. Some reexports are kept around, however: * `range` remains until range syntax has landed to reduce churn. * `Path` and `GenericPath` remain until path reform lands. This is done to prevent many imports of `GenericPath` which will soon be removed. * All `io` traits remain until I/O reform lands so imports can be rewritten all at once to `std::io::prelude::*`. This is a breaking change because many prelude reexports have been removed, and the RFC can be consulted for the exact list of removed reexports, as well as to find the locations of where to import them. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0503-prelude-stabilization.md [breaking-change] Closes #20068
2014-12-18std: Remove public bool,tuple,unit modulesAlex Crichton-0/+66
This commit modifies rustdoc to not require these empty modules to be public in the standard library. The modules still remain as a location to attach documentation to, but the modules themselves are now private (don't have to commit to an API). The documentation for the standard library now shows all of the primitive types on the main index page.
2014-05-07core: Inherit the tuple moduleAlex Crichton-350/+0
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-4/+5
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-1/+1
Closes #2569
2014-03-23std: remove the `equals` method from `TotalEq`.Huon Wilson-12/+1
`TotalEq` is now just an assertion about the `Eq` impl of a type (i.e. `==` is a total equality if a type implements `TotalEq`) so the extra method is just confusing. Also, a new method magically appeared as a hack to allow deriving to assert that the contents of a struct/enum are also TotalEq, because the deriving infrastructure makes it very hard to do anything but create a trait method. (You didn't hear about this horrible work-around from me :(.)
2014-02-28std: Change assert_eq!() to use {} instead of {:?}Alex Crichton-4/+4
Formatting via reflection has been a little questionable for some time now, and it's a little unfortunate that one of the standard macros will silently use reflection when you weren't expecting it. This adds small bits of code bloat to libraries, as well as not always being necessary. In light of this information, this commit switches assert_eq!() to using {} in the error message instead of {:?}. In updating existing code, there were a few error cases that I encountered: * It's impossible to define Show for [T, ..N]. I think DST will alleviate this because we can define Show for [T]. * A few types here and there just needed a #[deriving(Show)] * Type parameters needed a Show bound, I often moved this to `assert!(a == b)` * `Path` doesn't implement `Show`, so assert_eq!() cannot be used on two paths. I don't think this is much of a regression though because {:?} on paths looks awful (it's a byte array). Concretely speaking, this shaved 10K off a 656K binary. Not a lot, but sometime significant for smaller binaries.
2014-02-23Remove all ToStr impls, add Show implsAlex Crichton-7/+0
This commit changes the ToStr trait to: impl<T: fmt::Show> ToStr for T { fn to_str(&self) -> ~str { format!("{}", *self) } } The ToStr trait has been on the chopping block for quite awhile now, and this is the final nail in its coffin. The trait and the corresponding method are not being removed as part of this commit, but rather any implementations of the `ToStr` trait are being forbidden because of the generic impl. The new way to get the `to_str()` method to work is to implement `fmt::Show`. Formatting into a `&mut Writer` (as `format!` does) is much more efficient than `ToStr` when building up large strings. The `ToStr` trait forces many intermediate allocations to be made while the `fmt::Show` trait allows incremental buildup in the same heap allocated buffer. Additionally, the `fmt::Show` trait is much more extensible in terms of interoperation with other `Writer` instances and in more situations. By design the `ToStr` trait requires at least one allocation whereas the `fmt::Show` trait does not require any allocations. Closes #8242 Closes #9806
2014-02-20Mass rename if_ok! to try!Alex Crichton-3/+3
This "bubble up an error" macro was originally named if_ok! in order to get it landed, but after the fact it was discovered that this name is not exactly desirable. The name `if_ok!` isn't immediately clear that is has much to do with error handling, and it doesn't look fantastic in all contexts (if if_ok!(...) {}). In general, the agreed opinion about `if_ok!` is that is came in as subpar. The name `try!` is more invocative of error handling, it's shorter by 2 letters, and it looks fitting in almost all circumstances. One concern about the word `try!` is that it's too invocative of exceptions, but the belief is that this will be overcome with documentation and examples. Close #12037
2014-02-17Remove CloneableTuple and ImmutableTuple traitsBrendan Zabarauskas-76/+1
These are adequately covered by the Tuple2 trait.
2014-02-17Improve naming of tuple getters, and add mutable tuple getterBrendan Zabarauskas-125/+128
Renames the `n*` and `n*_ref` tuple getters to `val*` and `ref*` respectively, and adds `mut*` getters.
2014-02-16Merge ImmutableTuple* traits into their respective Tuple* traitBrendan Zabarauskas-35/+16
2014-02-16Delegate ToStr implementation to Show for tuplesBrendan Zabarauskas-0/+7
2014-02-16Implement Show for 1-12 element tuplesBrendan Zabarauskas-0/+26
2014-01-28Rename CopyableTuple to CloneableTupleVirgile Andreani-2/+2
2014-01-20Add operator trait constraints to std::num::{Zero, One} and document their ↵Brendan Zabarauskas-13/+0
appropriate use Zero and One have precise definitions in mathematics. Documentation has been added to describe the appropriate uses for these traits and the laws that they should satisfy. For more information regarding these identities, see the following wikipedia pages: - http://wikipedia.org/wiki/Additive_identity - http://wikipedia.org/wiki/Multiplicative_identity
2013-11-29Removed a few macro-expanding-to-module workaroundsMarvin Löbel-95/+89
Also documented a few issues
2013-09-25std: Replace CloneableTuple with Tuple, which takes self by-val.Huon Wilson-98/+100
The old behaviour of `foo.n0()` is replaced by `foo.n0_ref().clone()`.
2013-09-12std: Add a bunch of Default implsErick Tryzelaar-0/+9
2013-08-27librustc: Ensure that type parameters are in the right positions in paths.Patrick Walton-1/+1
This removes the stacking of type parameters that occurs when invoking trait methods, and fixes all places in the standard library that were relying on it. It is somewhat awkward in places; I think we'll probably want something like the `Foo::<for T>::new()` syntax.
2013-08-15tuple: remove obsolete ExtendedTupleOpsDaniel Micay-52/+0
replaced by iterators (generic composable `map` and `zip` adaptors)
2013-08-12auto merge of #8400 : blake2-ppc/rust/seq-ord, r=cmrbors-31/+49
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-10std: Rename Iterator.transform -> .mapErick Tryzelaar-2/+2
cc #5898
2013-08-10std: merge Iterator and IteratorUtilErick Tryzelaar-1/+1
2013-08-09std::tuple: Use != properly in Eq::ne for tuplesblake2-ppc-1/+1
Just like the Ord methods, Eq::ne needs to be implemented in terms of the same operation on the elements.
2013-08-08std: Fix tuple lexicographical orderblake2-ppc-14/+28
Use the definition, where R is <, <=, >=, or > [x, ..xs] R [y, ..ys] = if x != y { x R y } else { xs R ys } Previously, tuples would only implement < and derive the other comparisons from it; this is incorrect. Included are several testcases involving NaN comparisons that are now correct. Previously, tuples would consider an element equal if both a < b and b < a were false, this was also incorrect.
2013-08-08std: Implement traits for the one-tupleblake2-ppc-20/+24
(A,) did not have the trait implementations of 2- to 12- tuples.
2013-07-20rm obsolete no-op lintsDaniel Micay-1/+0
2013-07-17librustc: Remove all uses of the `Copy` bound.Patrick Walton-7/+3
2013-07-17librustc: Remove all uses of "copy".Patrick Walton-8/+16
2013-06-30Remove vec::{map, mapi, zip_map} and the methods, except for .map, since thisHuon Wilson-2/+4
is very common, and the replacement (.iter().transform().collect()) is very ugly.
2013-06-18replace #[inline(always)] with #[inline]. r=burningtree.Graydon Hoare-18/+18
2013-06-16Add copies to type params with Copy boundNiko Matsakis-3/+3
2013-06-14Add Zero impls for lots of common typesAlex Crichton-0/+13
2013-06-04librustc: Disallow multiple patterns from appearing in a "let" declaration.Patrick Walton-1/+1
You can still initialize multiple variables at once with "let (x, y) = (1, 2)".
2013-05-30Require documentation by default for libstdAlex Crichton-0/+10
Adds documentation for various things that I understand. Adds #[allow(missing_doc)] for lots of things that I don't understand.
2013-05-22libstd: Rename libcore to libstd and libstd to libextra; update makefiles.Patrick Walton-0/+439
This only changes the directory names; it does not change the "real" metadata names.
2012-01-17libstd => libcoreLenny222-28/+0