diff options
| author | Zeyla Hellyer <[email protected]> | 2018-04-26 21:02:02 -0700 |
|---|---|---|
| committer | Ken Swenson <[email protected]> | 2018-11-06 20:30:49 -0500 |
| commit | 0de0a81be06268f8ec57c8d825cbc70355fe869a (patch) | |
| tree | 9cfeaf04035c5623c720a6252be9470a03ccbd8f /src/model/user.rs | |
| parent | Permit sending files through the `CreateMessage` builder. (diff) | |
| download | serenity-0de0a81be06268f8ec57c8d825cbc70355fe869a.tar.xz serenity-0de0a81be06268f8ec57c8d825cbc70355fe869a.zip | |
Make builders mutably borrowed
Change the builders so that they are now mutably borrowed, accepting
`&mut self` instead of `self`. Their methods now return `()` instead of
`Self`.
Upgrade path:
Change code such as the following:
```rust
channel.send_message(|m| m
.embed(|e| e
.description("test")
.title("title")));
```
to the following style:
```rust
channel.send_message(|mut m| {
m.embed(|mut e| {
e.description("test");
e.title("title");
e
});
m
});
```
Closes #159.
Diffstat (limited to 'src/model/user.rs')
| -rw-r--r-- | src/model/user.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/model/user.rs b/src/model/user.rs index 1e90cb4..af09d4e 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -438,7 +438,13 @@ impl User { /// url, /// ); /// - /// match msg.author.direct_message(|m| m.content(&help)) { + /// let dm = msg.author.direct_message(|mut m| { + /// m.content(&help); + /// + /// m + /// }); + /// + /// match dm { /// Ok(_) => { /// let _ = msg.react('👌'); /// }, |