Skip to content

Commit 0c2e98b

Browse files
committed
async UDP: Better names for bound sockets
1 parent f58f4fd commit 0c2e98b

File tree

1 file changed

+12
-10
lines changed
  • embedded-nal-async/src/stack

1 file changed

+12
-10
lines changed

embedded-nal-async/src/stack/udp.rs

+12-10
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
//! themselves UDP and --> may pretend to have performed some form of network address
88
//! translation, and present invalid addresses as the local address.
99
//!
10-
//! * Implementing [`UdpStack::Bound`] and [`UdpStack::Unbound`] unconnected sockets separately
11-
//! allows discarding the local addresses in the bound case. With LTO enabled, all the overhead
12-
//! compared with a third trait variant between [ConnectedUdp] and [UnconnectedUdp] (in which the
13-
//! local address is static but the remote address is flexible) should optimized out.
14-
//! Implementing `Bound` and `Unbound` with the same type is expected to be a common choice.
10+
//! * Implementing [`UdpStack::UniquelyBound`] and [`UdpStack::MultiplyBound`] unconnected sockets
11+
//! separately allows discarding the local addresses in the bound case. With LTO enabled, all the
12+
//! overhead compared with a third trait variant between [ConnectedUdp] and [UnconnectedUdp] (in
13+
//! which the local address is static but the remote address is flexible) should optimized out.
14+
//! Implementing `UniquelyBound` and `MultiplyBound` with the same type is expected to be a
15+
//! common choice.
1516
1617
use core::future::Future;
1718
use no_std_net::SocketAddr;
@@ -141,11 +142,11 @@ pub trait UdpStack {
141142
where
142143
Self: 'm;
143144
/// Eventual socket return type of the [`.bind_single()`] method
144-
type Bound<'m>: UnconnectedUdp
145+
type UniquelyBound<'m>: UnconnectedUdp
145146
where
146147
Self: 'm;
147148
/// Eventual return type of the [`.bind_multiple()`] method
148-
type Unbound<'m>: UnconnectedUdp
149+
type MultiplyBound<'m>: UnconnectedUdp
149150
where
150151
Self: 'm;
151152

@@ -196,8 +197,9 @@ pub trait UdpStack {
196197
/// other protocols for advertising purposes.
197198
fn bind_single(&self, local: SocketAddr) -> Self::BindSingleFuture<'_>;
198199
/// Future return type of the [`.bind_single()`] method
199-
type BindSingleFuture<'a>: Future<Output = Result<(SocketAddr, Self::Bound<'a>), Self::Error>>
200-
where
200+
type BindSingleFuture<'a>: Future<
201+
Output = Result<(SocketAddr, Self::UniquelyBound<'a>), Self::Error>,
202+
> where
201203
Self: 'a;
202204

203205
/// Create a socket that has no single fixed local address.
@@ -224,7 +226,7 @@ pub trait UdpStack {
224226
/// interface and IP address unspecified.
225227
fn bind_multiple(&self, local: SocketAddr) -> Self::BindMultipleFuture<'_>;
226228
/// Future return type of the [`.bind_multiple()`] method
227-
type BindMultipleFuture<'a>: Future<Output = Result<Self::Unbound<'a>, Self::Error>>
229+
type BindMultipleFuture<'a>: Future<Output = Result<Self::MultiplyBound<'a>, Self::Error>>
228230
where
229231
Self: 'a;
230232
}

0 commit comments

Comments
 (0)