diff options
| author | Leon Camus <[email protected]> | 2023-03-07 23:40:20 +0100 |
|---|---|---|
| committer | Leon Camus <[email protected]> | 2023-03-07 23:40:31 +0100 |
| commit | b62e3e1d47ef6d326e4b214bd7ac1e52142f2e3d (patch) | |
| tree | fb04d472371be62d18248a2808919a4a138fc006 /embassy-net | |
| parent | 468c4266c839fdb77350087b91e3ccd0aa2654be (diff) | |
lint: Cargo fmt
Diffstat (limited to 'embassy-net')
| -rw-r--r-- | embassy-net/src/lib.rs | 22 | ||||
| -rw-r--r-- | embassy-net/src/udp.rs | 13 |
2 files changed, 13 insertions, 22 deletions
diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs index 57055bd77..05bbd07f2 100644 --- a/embassy-net/src/lib.rs +++ b/embassy-net/src/lib.rs | |||
| @@ -307,32 +307,26 @@ impl<D: Driver + 'static> Stack<D> { | |||
| 307 | #[cfg(feature = "igmp")] | 307 | #[cfg(feature = "igmp")] |
| 308 | impl<D: Driver + smoltcp::phy::Device + 'static> Stack<D> { | 308 | impl<D: Driver + smoltcp::phy::Device + 'static> Stack<D> { |
| 309 | pub(crate) fn join_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError> | 309 | pub(crate) fn join_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError> |
| 310 | where | 310 | where |
| 311 | T: Into<IpAddress> | 311 | T: Into<IpAddress>, |
| 312 | { | 312 | { |
| 313 | let addr = addr.into(); | 313 | let addr = addr.into(); |
| 314 | 314 | ||
| 315 | self.with_mut(|s, i| { | 315 | self.with_mut(|s, i| { |
| 316 | s.iface.join_multicast_group( | 316 | s.iface |
| 317 | &mut i.device, | 317 | .join_multicast_group(&mut i.device, addr, instant_to_smoltcp(Instant::now())) |
| 318 | addr, | ||
| 319 | instant_to_smoltcp(Instant::now()), | ||
| 320 | ) | ||
| 321 | }) | 318 | }) |
| 322 | } | 319 | } |
| 323 | 320 | ||
| 324 | pub(crate) fn leave_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError> | 321 | pub(crate) fn leave_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError> |
| 325 | where | 322 | where |
| 326 | T: Into<IpAddress> | 323 | T: Into<IpAddress>, |
| 327 | { | 324 | { |
| 328 | let addr = addr.into(); | 325 | let addr = addr.into(); |
| 329 | 326 | ||
| 330 | self.with_mut(|s, i| { | 327 | self.with_mut(|s, i| { |
| 331 | s.iface.leave_multicast_group( | 328 | s.iface |
| 332 | &mut i.device, | 329 | .leave_multicast_group(&mut i.device, addr, instant_to_smoltcp(Instant::now())) |
| 333 | addr, | ||
| 334 | instant_to_smoltcp(Instant::now()), | ||
| 335 | ) | ||
| 336 | }) | 330 | }) |
| 337 | } | 331 | } |
| 338 | 332 | ||
diff --git a/embassy-net/src/udp.rs b/embassy-net/src/udp.rs index c840eeaa2..a8a426048 100644 --- a/embassy-net/src/udp.rs +++ b/embassy-net/src/udp.rs | |||
| @@ -50,10 +50,7 @@ impl<'a, D: Driver> UdpSocket<'a, D> { | |||
| 50 | udp::PacketBuffer::new(tx_meta, tx_buffer), | 50 | udp::PacketBuffer::new(tx_meta, tx_buffer), |
| 51 | )); | 51 | )); |
| 52 | 52 | ||
| 53 | Self { | 53 | Self { stack, handle } |
| 54 | stack, | ||
| 55 | handle, | ||
| 56 | } | ||
| 57 | } | 54 | } |
| 58 | 55 | ||
| 59 | pub fn bind<T>(&mut self, endpoint: T) -> Result<(), BindError> | 56 | pub fn bind<T>(&mut self, endpoint: T) -> Result<(), BindError> |
| @@ -146,15 +143,15 @@ impl<'a, D: Driver> UdpSocket<'a, D> { | |||
| 146 | #[cfg(feature = "igmp")] | 143 | #[cfg(feature = "igmp")] |
| 147 | impl<'a, D: Driver + smoltcp::phy::Device + 'static> UdpSocket<'a, D> { | 144 | impl<'a, D: Driver + smoltcp::phy::Device + 'static> UdpSocket<'a, D> { |
| 148 | pub fn join_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError> | 145 | pub fn join_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError> |
| 149 | where | 146 | where |
| 150 | T: Into<IpAddress> | 147 | T: Into<IpAddress>, |
| 151 | { | 148 | { |
| 152 | self.stack.join_multicast_group(addr) | 149 | self.stack.join_multicast_group(addr) |
| 153 | } | 150 | } |
| 154 | 151 | ||
| 155 | pub fn leave_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError> | 152 | pub fn leave_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError> |
| 156 | where | 153 | where |
| 157 | T: Into<IpAddress> | 154 | T: Into<IpAddress>, |
| 158 | { | 155 | { |
| 159 | self.stack.leave_multicast_group(addr) | 156 | self.stack.leave_multicast_group(addr) |
| 160 | } | 157 | } |
