From 6a37d2a765cda837f1eab9d6f0501fae350a363d Mon Sep 17 00:00:00 2001 From: chrysn Date: Mon, 8 Apr 2024 14:12:15 +0200 Subject: [PATCH] Make the UDP socket's `.with` pub This helps develop https://github.com/embassy-rs/embassy/issues/2516 out-of-tree. Not cherry-picked from any PR. --- embassy-net/src/udp.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/embassy-net/src/udp.rs b/embassy-net/src/udp.rs index 6e50c4e011..7801dde2df 100644 --- a/embassy-net/src/udp.rs +++ b/embassy-net/src/udp.rs @@ -92,7 +92,8 @@ impl<'a> UdpSocket<'a> { } } - fn with(&self, f: impl FnOnce(&udp::Socket, &Interface) -> R) -> R { + /// Lock the stack, provide access to the underlying smoltcp UDP socket and interface + pub fn with(&self, f: impl FnOnce(&udp::Socket, &Interface) -> R) -> R { let s = &*self.stack.borrow(); let socket = s.sockets.get::(self.handle); f(socket, &s.iface)