Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdded some examples fo mio::net::UdpSocket. #762
Conversation
This comment has been minimized.
This comment has been minimized.
|
Thanks for the PR! I think including a full example for the struct level docs is probably good, however, for each individual function, would it be possible to reduce down the example to focus on the function as question? This should make it easier to see the relevant bits. Ideally, none of the fn level examples would include a full event loop. |
This comment has been minimized.
This comment has been minimized.
|
Hey, should the examples hide the event loop with # Ok(())
socket.send_to(&buffer, &addr);Or something else entirely? |
carllerche
reviewed
Nov 20, 2017
|
Woops, it seems like I never clicked "send" for this comment. |
| /// use mio::{Events, Ready, Poll, PollOpt, Token}; | ||
| /// use std::time::Duration; | ||
| /// | ||
| /// const SENDER: Token = Token(0x4c4f4f43); |
This comment has been minimized.
This comment has been minimized.
carllerche
Nov 20, 2017
Owner
Maybe just use 0 / 1 here? The other examples do that and I think we want to try to stick with a single style.
This comment has been minimized.
This comment has been minimized.
|
@lanedraex sticking with fake calls is fine. You can use the |
carllerche
merged commit 90bfc7d
into
carllerche:master
Dec 15, 2017
This comment has been minimized.
This comment has been minimized.
|
@lanedraex Thanks, these examples look great. |
This comment has been minimized.
This comment has been minimized.
|
I'll add examples to the other methods. Also, just noticed that I made a typo in the pull request title, sorry. |
lanedraex commentedNov 16, 2017
Some rustdoc examples: (#665)
Includes examples for: UdpSocket, bind, local_addr, send_to, recv_from, set_broadcast, broadcast.