diff options
| author | Roy Buitenhuis <[email protected]> | 2023-07-12 11:32:02 +0200 |
|---|---|---|
| committer | Roy Buitenhuis <[email protected]> | 2023-07-12 11:32:02 +0200 |
| commit | f192f440187c705ce2674731c4d595dc327f08a3 (patch) | |
| tree | a2db15460c077cd32187d6b84d2df64b9f584c1f /embassy-net/src | |
| parent | b81c14f442839de61f2217cf88e09d390d465f3d (diff) | |
fmt
Diffstat (limited to 'embassy-net/src')
| -rw-r--r-- | embassy-net/src/udp.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/embassy-net/src/udp.rs b/embassy-net/src/udp.rs index 16f48bcb0..0d97b6db1 100644 --- a/embassy-net/src/udp.rs +++ b/embassy-net/src/udp.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | use core::cell::RefCell; | 3 | use core::cell::RefCell; |
| 4 | use core::future::poll_fn; | 4 | use core::future::poll_fn; |
| 5 | use core::mem; | 5 | use core::mem; |
| 6 | use core::task::{Poll, Context}; | 6 | use core::task::{Context, Poll}; |
| 7 | 7 | ||
| 8 | use embassy_net_driver::Driver; | 8 | use embassy_net_driver::Driver; |
| 9 | use smoltcp::iface::{Interface, SocketHandle}; | 9 | use smoltcp::iface::{Interface, SocketHandle}; |
| @@ -106,13 +106,13 @@ impl<'a> UdpSocket<'a> { | |||
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | /// Receive a datagram. | 108 | /// Receive a datagram. |
| 109 | /// | 109 | /// |
| 110 | /// When no datagram is available, this method will return `Poll::Pending` and | 110 | /// When no datagram is available, this method will return `Poll::Pending` and |
| 111 | /// register the current task to be notified when a datagram is received. | 111 | /// register the current task to be notified when a datagram is received. |
| 112 | /// | 112 | /// |
| 113 | /// When a datagram is received, this method will return `Poll::Ready` with the | 113 | /// When a datagram is received, this method will return `Poll::Ready` with the |
| 114 | /// number of bytes received and the remote endpoint. | 114 | /// number of bytes received and the remote endpoint. |
| 115 | pub fn poll_recv_from(&self, buf: &mut[u8], cx: &mut Context<'_>) -> Poll<Result<(usize, IpEndpoint), Error>> { | 115 | pub fn poll_recv_from(&self, buf: &mut [u8], cx: &mut Context<'_>) -> Poll<Result<(usize, IpEndpoint), Error>> { |
| 116 | self.with_mut(|s, _| match s.recv_slice(buf) { | 116 | self.with_mut(|s, _| match s.recv_slice(buf) { |
| 117 | Ok((n, meta)) => Poll::Ready(Ok((n, meta.endpoint))), | 117 | Ok((n, meta)) => Poll::Ready(Ok((n, meta.endpoint))), |
| 118 | // No data ready | 118 | // No data ready |
| @@ -124,9 +124,9 @@ impl<'a> UdpSocket<'a> { | |||
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | /// Send a datagram to the specified remote endpoint. | 126 | /// Send a datagram to the specified remote endpoint. |
| 127 | /// | 127 | /// |
| 128 | /// This method will wait until the datagram has been sent. | 128 | /// This method will wait until the datagram has been sent. |
| 129 | /// | 129 | /// |
| 130 | /// When the remote endpoint is not reachable, this method will return `Err(Error::NoRoute)` | 130 | /// When the remote endpoint is not reachable, this method will return `Err(Error::NoRoute)` |
| 131 | pub async fn send_to<T>(&self, buf: &[u8], remote_endpoint: T) -> Result<(), Error> | 131 | pub async fn send_to<T>(&self, buf: &[u8], remote_endpoint: T) -> Result<(), Error> |
| 132 | where | 132 | where |
| @@ -137,12 +137,12 @@ impl<'a> UdpSocket<'a> { | |||
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | /// Send a datagram to the specified remote endpoint. | 139 | /// Send a datagram to the specified remote endpoint. |
| 140 | /// | 140 | /// |
| 141 | /// When the datagram has been sent, this method will return `Poll::Ready(Ok())`. | 141 | /// When the datagram has been sent, this method will return `Poll::Ready(Ok())`. |
| 142 | /// | 142 | /// |
| 143 | /// When the socket's send buffer is full, this method will return `Poll::Pending` | 143 | /// When the socket's send buffer is full, this method will return `Poll::Pending` |
| 144 | /// and register the current task to be notified when the buffer has space available. | 144 | /// and register the current task to be notified when the buffer has space available. |
| 145 | /// | 145 | /// |
| 146 | /// When the remote endpoint is not reachable, this method will return `Poll::Ready(Err(Error::NoRoute))`. | 146 | /// When the remote endpoint is not reachable, this method will return `Poll::Ready(Err(Error::NoRoute))`. |
| 147 | pub fn poll_send_to<T>(&self, buf: &[u8], remote_endpoint: T, cx: &mut Context<'_>) -> Poll<Result<(), Error>> | 147 | pub fn poll_send_to<T>(&self, buf: &[u8], remote_endpoint: T, cx: &mut Context<'_>) -> Poll<Result<(), Error>> |
| 148 | where | 148 | where |
