aboutsummaryrefslogtreecommitdiff
path: root/embassy-net-driver-channel/src/lib.rs
diff options
context:
space:
mode:
authorRuben De Smet <[email protected]>2023-08-11 12:07:30 +0200
committerDario Nieuwenhuis <[email protected]>2023-09-04 22:13:27 +0200
commit1eb03dc41a4a5fa8435f9a49d26e29ceea6d498e (patch)
tree21c150dfc1720c085a2bb665aec30f3453f58816 /embassy-net-driver-channel/src/lib.rs
parenta2656f402b1c59461cec5f5dc685b2692119b996 (diff)
Prefer `receive` over `recv`
Diffstat (limited to 'embassy-net-driver-channel/src/lib.rs')
-rw-r--r--embassy-net-driver-channel/src/lib.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/embassy-net-driver-channel/src/lib.rs b/embassy-net-driver-channel/src/lib.rs
index e8cd66f8d..a20760749 100644
--- a/embassy-net-driver-channel/src/lib.rs
+++ b/embassy-net-driver-channel/src/lib.rs
@@ -131,24 +131,24 @@ impl<'d, const MTU: usize> Runner<'d, MTU> {
131 } 131 }
132 132
133 pub async fn tx_buf(&mut self) -> &mut [u8] { 133 pub async fn tx_buf(&mut self) -> &mut [u8] {
134 let p = self.tx_chan.recv().await; 134 let p = self.tx_chan.receive().await;
135 &mut p.buf[..p.len] 135 &mut p.buf[..p.len]
136 } 136 }
137 137
138 pub fn try_tx_buf(&mut self) -> Option<&mut [u8]> { 138 pub fn try_tx_buf(&mut self) -> Option<&mut [u8]> {
139 let p = self.tx_chan.try_recv()?; 139 let p = self.tx_chan.try_receive()?;
140 Some(&mut p.buf[..p.len]) 140 Some(&mut p.buf[..p.len])
141 } 141 }
142 142
143 pub fn poll_tx_buf(&mut self, cx: &mut Context) -> Poll<&mut [u8]> { 143 pub fn poll_tx_buf(&mut self, cx: &mut Context) -> Poll<&mut [u8]> {
144 match self.tx_chan.poll_recv(cx) { 144 match self.tx_chan.poll_receive(cx) {
145 Poll::Ready(p) => Poll::Ready(&mut p.buf[..p.len]), 145 Poll::Ready(p) => Poll::Ready(&mut p.buf[..p.len]),
146 Poll::Pending => Poll::Pending, 146 Poll::Pending => Poll::Pending,
147 } 147 }
148 } 148 }
149 149
150 pub fn tx_done(&mut self) { 150 pub fn tx_done(&mut self) {
151 self.tx_chan.recv_done(); 151 self.tx_chan.receive_done();
152 } 152 }
153} 153}
154 154
@@ -205,24 +205,24 @@ impl<'d, const MTU: usize> RxRunner<'d, MTU> {
205 205
206impl<'d, const MTU: usize> TxRunner<'d, MTU> { 206impl<'d, const MTU: usize> TxRunner<'d, MTU> {
207 pub async fn tx_buf(&mut self) -> &mut [u8] { 207 pub async fn tx_buf(&mut self) -> &mut [u8] {
208 let p = self.tx_chan.recv().await; 208 let p = self.tx_chan.receive().await;
209 &mut p.buf[..p.len] 209 &mut p.buf[..p.len]
210 } 210 }
211 211
212 pub fn try_tx_buf(&mut self) -> Option<&mut [u8]> { 212 pub fn try_tx_buf(&mut self) -> Option<&mut [u8]> {
213 let p = self.tx_chan.try_recv()?; 213 let p = self.tx_chan.try_receive()?;
214 Some(&mut p.buf[..p.len]) 214 Some(&mut p.buf[..p.len])
215 } 215 }
216 216
217 pub fn poll_tx_buf(&mut self, cx: &mut Context) -> Poll<&mut [u8]> { 217 pub fn poll_tx_buf(&mut self, cx: &mut Context) -> Poll<&mut [u8]> {
218 match self.tx_chan.poll_recv(cx) { 218 match self.tx_chan.poll_receive(cx) {
219 Poll::Ready(p) => Poll::Ready(&mut p.buf[..p.len]), 219 Poll::Ready(p) => Poll::Ready(&mut p.buf[..p.len]),
220 Poll::Pending => Poll::Pending, 220 Poll::Pending => Poll::Pending,
221 } 221 }
222 } 222 }
223 223
224 pub fn tx_done(&mut self) { 224 pub fn tx_done(&mut self) {
225 self.tx_chan.recv_done(); 225 self.tx_chan.receive_done();
226 } 226 }
227} 227}
228 228
@@ -294,7 +294,7 @@ impl<'d, const MTU: usize> embassy_net_driver::Driver for Device<'d, MTU> {
294 type TxToken<'a> = TxToken<'a, MTU> where Self: 'a ; 294 type TxToken<'a> = TxToken<'a, MTU> where Self: 'a ;
295 295
296 fn receive(&mut self, cx: &mut Context) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> { 296 fn receive(&mut self, cx: &mut Context) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> {
297 if self.rx.poll_recv(cx).is_ready() && self.tx.poll_send(cx).is_ready() { 297 if self.rx.poll_receive(cx).is_ready() && self.tx.poll_send(cx).is_ready() {
298 Some((RxToken { rx: self.rx.borrow() }, TxToken { tx: self.tx.borrow() })) 298 Some((RxToken { rx: self.rx.borrow() }, TxToken { tx: self.tx.borrow() }))
299 } else { 299 } else {
300 None 300 None
@@ -338,9 +338,9 @@ impl<'a, const MTU: usize> embassy_net_driver::RxToken for RxToken<'a, MTU> {
338 F: FnOnce(&mut [u8]) -> R, 338 F: FnOnce(&mut [u8]) -> R,
339 { 339 {
340 // NOTE(unwrap): we checked the queue wasn't full when creating the token. 340 // NOTE(unwrap): we checked the queue wasn't full when creating the token.
341 let pkt = unwrap!(self.rx.try_recv()); 341 let pkt = unwrap!(self.rx.try_receive());
342 let r = f(&mut pkt.buf[..pkt.len]); 342 let r = f(&mut pkt.buf[..pkt.len]);
343 self.rx.recv_done(); 343 self.rx.receive_done();
344 r 344 r
345 } 345 }
346} 346}