From 6178966b3cfce107d096e0aecce93bc0aa810686 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Fri, 12 Feb 2021 23:05:23 +0100 Subject: [PATCH] net: update UdpSocket splitting doc --- tokio/src/net/udp.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tokio/src/net/udp.rs b/tokio/src/net/udp.rs index 2b0394112be..6e6335556f8 100644 --- a/tokio/src/net/udp.rs +++ b/tokio/src/net/udp.rs @@ -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` 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` + /// 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` to get multiple shared handles to the + /// same socket. An example of such usage can be found further down. /// /// [`Arc`]: std::sync::Arc ///