Skip to content

Commit

Permalink
net: update UdpSocket splitting doc (#3517)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darksonn authored Feb 13, 2021
1 parent 4099bfd commit 7c6a1c4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tokio/src/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ cfg_net! {
/// and [`recv`](`UdpSocket::recv`) to communicate only with that remote address
///
/// This type does not provide a `split` method, because this functionality
/// can be achieved by wrapping the socket in an [`Arc`]. Note that you do
/// not need a `Mutex` to share the `UdpSocket` — an `Arc<UdpSocket>` is
/// enough. This is because all of the methods take `&self` instead of `&mut
/// self`.
/// can be achieved by instead wrapping the socket in an [`Arc`]. Note that
/// you do not need a `Mutex` to share the `UdpSocket` — an `Arc<UdpSocket>`
/// is enough. This is because all of the methods take `&self` instead of
/// `&mut self`. Once you have wrapped it in an `Arc`, you can call
/// `.clone()` on the `Arc<UdpSocket>` to get multiple shared handles to the
/// same socket. An example of such usage can be found further down.
///
/// [`Arc`]: std::sync::Arc
///
Expand Down

0 comments on commit 7c6a1c4

Please sign in to comment.