From 7c6a1c463773d435a4a36486ac5c21850a0eaf0c Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sat, 13 Feb 2021 11:13:42 +0100 Subject: [PATCH] net: update UdpSocket splitting doc (#3517) --- 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 2b0394112..6e6335556 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 ///