Alex Crichton
a8ba31dbf3
std: Remove usage of fmt!
2013-09-30 23:21:18 -07:00
Alex Crichton
3585c64d09
rustdoc: Change all code-blocks with a script
...
find src -name '*.rs' | xargs sed -i '' 's/~~~.*{\.rust}/```rust/g'
find src -name '*.rs' | xargs sed -i '' 's/ ~~~$/ ```/g'
find src -name '*.rs' | xargs sed -i '' 's/^~~~$/ ```/g'
2013-09-25 14:27:42 -07:00
Grigoriy
eb519b952d
Fix example in std::Option
2013-09-21 02:00:20 +04:00
Erick Tryzelaar
5ab843fbc3
std: Remove Option.or_{default,zero}
...
These can be replaced with `Some(option.or_default())`.
2013-09-17 19:50:41 -07:00
Daniel Micay
4e161a4d40
switch Drop to &mut self
2013-09-16 22:19:23 -04:00
Erick Tryzelaar
7f9c5aae9e
std: Restore Option::chain{,_mut}_ref as and_then{,_mut}_ref
2013-09-12 18:54:28 -07:00
Erick Tryzelaar
f107718a9b
std: Remove Zero impl for Option
...
Options are not numeric types, so it doesn't make sense for them to
implement Zero.
2013-09-12 18:54:13 -07:00
Erick Tryzelaar
ca47eebb44
std: Add a bunch of Default impls
2013-09-12 18:54:13 -07:00
Erick Tryzelaar
38f97ea103
std: Rename {Option,Result}::chain{,_err}* to {and_then,or_else}
2013-09-12 18:54:13 -07:00
Erick Tryzelaar
e03d60e9eb
std: Add ToEither/IntoEither/AsEither
2013-09-12 18:54:12 -07:00
Erick Tryzelaar
12e0d7ecf0
std: Add ToResult/IntoResult/AsResult
2013-09-12 18:54:12 -07:00
Erick Tryzelaar
ff34740a29
std: Add ToOption/IntoOption/AsOption
2013-09-12 18:54:12 -07:00
Erick Tryzelaar
d625d4a598
std: Add Option.{and,and_then,or,or_else}
2013-09-12 18:54:12 -07:00
Erick Tryzelaar
7380b1ce7f
std: Add Option.unwrap_or_else and a couple tests
2013-09-12 18:54:12 -07:00
Erick Tryzelaar
e6c11313c8
std: Add Option.{result_or_default,or_default} that uses Default
2013-09-12 18:54:12 -07:00
Erick Tryzelaar
4a73c8eac7
std: add default implementations to Option
2013-09-12 18:54:12 -07:00
Erick Tryzelaar
45c62c08f9
std: rename Option::unwrap_or_default() to unwrap_or()
2013-09-12 18:54:11 -07:00
Daniel Micay
6919cf5fe1
rename std::iterator
to std::iter
...
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-09 03:21:46 -04:00
blake2-ppc
7c369ee733
std/extra: Add ExactSize for Bitv, DList, RingBuf, Option iterators
2013-09-01 18:20:24 +02:00
Daniel Micay
9a63be1dbd
option: rm implementation of Add
...
Closes #6002
There is consensus that the current implementation should be changed or
removed, so removing it seems like the right decision for now.
2013-08-27 13:18:57 -04:00
Vadim Chugunov
12ecdb6381
Enabled unit tests in std and extra.
2013-08-22 20:02:20 -07:00
Daniel Micay
b68eedf846
option: derive Clone/DeepClone for the iterator
2013-08-20 22:05:03 -04:00
Marvin Löbel
a00becd0eb
Methodyfied the string ascii extionsion functions
...
Added into_owned() method for vectors
Added DoubleEnded Iterator impl to Option
Renamed nil.rs to unit.rs
2013-08-14 14:48:25 +02:00
bors
35040275b3
auto merge of #8400 : blake2-ppc/rust/seq-ord, r=cmr
...
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-12 11:53:18 -07:00
Erick Tryzelaar
fad7857c7b
Mass rename of .consume{,_iter}() to .move_iter()
...
cc #7887
2013-08-10 07:01:07 -07:00
blake2-ppc
86da55e85b
std: Fix Ord for Option, using iterator::order
2013-08-08 22:07:22 +02:00
Erick Tryzelaar
19e17f54a0
std: removed option.take_map{,_default}
2013-08-07 08:52:09 -07:00
Erick Tryzelaar
1e490813b0
core: option.map_consume -> option.map_move
2013-08-07 08:52:09 -07:00
blake2-ppc
520f292e48
std: Use method name Option::consume
...
With Option as the simplest container, `consume` is the way to turn it
into a by-value iterator.
2013-08-06 04:05:07 +02:00
blake2-ppc
ce682cb45f
std: Add .consume_iter() for Option, to make it reusable
...
Let Option be a base for a widely useful one- or zero- item iterator.
Refactor OptionIterator to support any generic element type, so the same
iterator impl can be used for both &T, &mut T and T iterators.
2013-08-06 03:59:56 +02:00
Marvin Löbel
0ac7a219f0
Updated std::Option, std::Either and std::Result
...
- Made naming schemes consistent between Option, Result and Either
- Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None)
- Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-05 22:42:21 +02:00
Daniel Micay
1008945528
remove obsolete foreach
keyword
...
this has been replaced by `for`
2013-08-03 22:48:02 -04:00
Kevin Ballard
54e685d4fd
option: mutate() and mutate_default() should return bool
...
Fixes #8047 .
2013-08-03 03:11:11 -04:00
Daniel Micay
1fc4db2d08
migrate many for
loops to foreach
2013-08-01 05:34:55 -04:00
Erick Tryzelaar
796b3371f9
std: Put the option tests into a tests submodule
2013-07-27 23:42:53 -07:00
Erick Tryzelaar
03a16dbb8e
std: fix the casing of option::{Some,None} in the docs
2013-07-27 23:41:10 -07:00
bors
467d381d3a
auto merge of #7931 : blake2-ppc/rust/chain-mut-ref, r=pcwalton
...
First, clean up the uses of "None" and "Some" to always use consistent title case matching the variant names.
Add .chain_mut_ref() which is a missing method. A use case example for this method is extraction of an optional value from an Option\<Container\> value.
2013-07-24 19:25:38 -07:00
Erick Tryzelaar
cc9666f68f
std: rename str.as_buf to as_imm_buf, add str.as_mut_buf
2013-07-23 16:56:22 -07:00
Erick Tryzelaar
9fdec67a67
std: move str::as_buf into StrSlice
2013-07-23 16:56:22 -07:00
blake2-ppc
625ca7afe4
option: Add .chain_mut_ref()
...
.chain_mut_ref() is the mutable alternative to .chain_ref().
A use case example for this method is extraction of an optional value
from an Option<Container> value.
2013-07-20 19:19:13 +02:00
blake2-ppc
5991c60750
option: Title-case Some
and None
in docs and fail messages
...
For accuracy, say 'get_ref None' instead of 'get_ref none', and so on.
2013-07-20 19:19:13 +02:00
Ben Blum
728edb5af6
(cleanup) impl TaskSet
2013-07-20 05:08:58 -04:00
Ben Blum
e2a42416dd
Add option::take(), the building block of the option::take_* family.
2013-07-20 05:08:57 -04:00
Ben Blum
5a9b33a76d
Add Option::take_map{,_default}()
2013-07-20 05:08:55 -04:00
Patrick Walton
99b33f7219
librustc: Remove all uses of "copy".
2013-07-17 14:57:51 -07:00
Austin King
712ac836c6
Rename Option swap_unwrap to take_unwrap. Fixes Issue#7764
2013-07-16 12:47:01 -07:00
Andrew Paseltiner
f2bd4416fa
std: Implement Iterator::size_hint
method for Option
iterators
2013-07-09 16:35:56 -04:00
Alex Crichton
208eb0f8cb
Implement map_mut
on the Option type
...
Closes #7394
2013-06-29 22:21:37 -07:00
Alex Crichton
b29c368674
Removing a lot of usage of '&const'
2013-06-29 08:35:48 -07:00
Daniel Micay
779ee2a2dd
util: make NonCopyable 0 size (instead of 1 byte)
...
this also adds a derived Eq, TotalEq, Ord and TotalOrd along with
removing the useless constructor
2013-06-27 23:20:42 -04:00