This adds an example for most of the methods in Rng.
As a total newcomer to Rust, it took a while to figure out how to do basic things like use library functions, because there aren't many usage examples, and most examples that Google turns up are out of date. Something like this would have saved me a bit of time.
This might be a bit verbose. Some alternative options would be to consolidate all the examples into one section, or to only have code for the specific function call inline.
Good morning,
This first patch series adds support for `#[deriving(Decodable, Encodable)]`, but does not yet remove `#[auto_encode]` and `#[auto_decode]`. I need a snapshot to remove the old code. Along the way it also extends support for tuple structs and struct enum variants.
Also, it includes a minor fix to the pretty printer. We decided a while ago to use 4 spaces to indent a match arm instead of 2. This updates the pretty printer to reflect that.
There's no unifying theme here; I'm just trying to clear a bunch of small commits: removing dead code, adding comments, renaming to an upper-case type, fixing one test case.
Revert map.each to something which takes two parameters rather than a tuple. The current setup iterates over `BaseIter<(&'self K, &'self V)>` where 'self is a lifetime declared *in the `each()` method*. You can't place such a type in the impl declaration. The compiler currently allows it, but this will not be legal under #5656 and I'm pretty sure it's not sound now. It's too bad that maps can't implement `BaseIter` (at least not over a tuple as they do here) but I think it has to be this way for the time being.
r? @thestinger
rather than a tuple. The current setup iterates over
`BaseIter<(&'self K, &'self V)>` where 'self is a lifetime declared
*in the each method*. You can't place such a type in
the impl declaration. The compiler currently allows it,
but this will not be legal under #5656 and I'm pretty sure
it's not sound now.
#5758 take 2.
This adds a `#[packed]` attribute for structs, like GCC's `__attribute__((packed))`, e.g.
```rust
#[packed]
struct Size5 {
a: u8,
b: u32
}
```
It works on normal and tuple structs, but is (silently) ignored on enums.
Closes#1704.
A struct (inc. tuple struct) can be annotated with #[packed], so that there
is no padding between its elements, like GCC's `__attribute__((packed))`.
Closes#1704