Skip to content

Commit

Permalink
rustfmt for new nightly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirbaio committed Oct 13, 2024
1 parent ee669ee commit 9a45d77
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 15 deletions.
10 changes: 8 additions & 2 deletions embassy-net-driver-channel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,14 @@ pub struct Device<'d, const MTU: usize> {
}

impl<'d, const MTU: usize> embassy_net_driver::Driver for Device<'d, MTU> {
type RxToken<'a> = RxToken<'a, MTU> where Self: 'a ;
type TxToken<'a> = TxToken<'a, MTU> where Self: 'a ;
type RxToken<'a>
= RxToken<'a, MTU>
where
Self: 'a;
type TxToken<'a>
= TxToken<'a, MTU>
where
Self: 'a;

fn receive(&mut self, cx: &mut Context) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> {
if self.rx.poll_receive(cx).is_ready() && self.tx.poll_send(cx).is_ready() {
Expand Down
6 changes: 4 additions & 2 deletions embassy-net-driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ pub trait Driver {
}

impl<T: ?Sized + Driver> Driver for &mut T {
type RxToken<'a> = T::RxToken<'a>
type RxToken<'a>
= T::RxToken<'a>
where
Self: 'a;
type TxToken<'a> = T::TxToken<'a>
type TxToken<'a>
= T::TxToken<'a>
where
Self: 'a;

Expand Down
6 changes: 4 additions & 2 deletions embassy-net-enc28j60/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,13 @@ where
S: SpiDevice,
O: OutputPin,
{
type RxToken<'a> = RxToken<'a>
type RxToken<'a>
= RxToken<'a>
where
Self: 'a;

type TxToken<'a> = TxToken<'a, S, O>
type TxToken<'a>
= TxToken<'a, S, O>
where
Self: 'a;

Expand Down
10 changes: 8 additions & 2 deletions embassy-net-tuntap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,14 @@ impl TunTapDevice {
}

impl Driver for TunTapDevice {
type RxToken<'a> = RxToken where Self: 'a;
type TxToken<'a> = TxToken<'a> where Self: 'a;
type RxToken<'a>
= RxToken
where
Self: 'a;
type TxToken<'a>
= TxToken<'a>
where
Self: 'a;

fn receive(&mut self, cx: &mut Context) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> {
let mut buf = vec![0; self.device.get_ref().mtu];
Expand Down
10 changes: 8 additions & 2 deletions embassy-net/src/driver_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ impl<'d, 'c, T> phy::Device for DriverAdapter<'d, 'c, T>
where
T: Driver,
{
type RxToken<'a> = RxTokenAdapter<T::RxToken<'a>> where Self: 'a;
type TxToken<'a> = TxTokenAdapter<T::TxToken<'a>> where Self: 'a;
type RxToken<'a>
= RxTokenAdapter<T::RxToken<'a>>
where
Self: 'a;
type TxToken<'a>
= TxTokenAdapter<T::TxToken<'a>>
where
Self: 'a;

fn receive(&mut self, _timestamp: Instant) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> {
self.inner
Expand Down
5 changes: 4 additions & 1 deletion embassy-net/src/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,10 @@ pub mod client {
for TcpClient<'d, N, TX_SZ, RX_SZ>
{
type Error = Error;
type Connection<'m> = TcpConnection<'m, N, TX_SZ, RX_SZ> where Self: 'm;
type Connection<'m>
= TcpConnection<'m, N, TX_SZ, RX_SZ>
where
Self: 'm;

async fn connect<'a>(&'a self, remote: core::net::SocketAddr) -> Result<Self::Connection<'a>, Self::Error> {
let addr: crate::IpAddress = match remote.ip() {
Expand Down
10 changes: 8 additions & 2 deletions embassy-stm32-wpan/src/mac/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ impl<'d> Driver<'d> {
impl<'d> embassy_net_driver::Driver for Driver<'d> {
// type RxToken<'a> = RxToken<'a, 'd> where Self: 'a;
// type TxToken<'a> = TxToken<'a, 'd> where Self: 'a;
type RxToken<'a> = RxToken<'d> where Self: 'a;
type TxToken<'a> = TxToken<'d> where Self: 'a;
type RxToken<'a>
= RxToken<'d>
where
Self: 'a;
type TxToken<'a>
= TxToken<'d>
where
Self: 'a;

fn receive(&mut self, cx: &mut Context) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> {
if self.runner.rx_channel.poll_ready_to_receive(cx).is_ready()
Expand Down
10 changes: 8 additions & 2 deletions embassy-stm32/src/eth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,14 @@ impl<const TX: usize, const RX: usize> PacketQueue<TX, RX> {
static WAKER: AtomicWaker = AtomicWaker::new();

impl<'d, T: Instance, P: PHY> embassy_net_driver::Driver for Ethernet<'d, T, P> {
type RxToken<'a> = RxToken<'a, 'd> where Self: 'a;
type TxToken<'a> = TxToken<'a, 'd> where Self: 'a;
type RxToken<'a>
= RxToken<'a, 'd>
where
Self: 'a;
type TxToken<'a>
= TxToken<'a, 'd>
where
Self: 'a;

fn receive(&mut self, cx: &mut Context) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> {
WAKER.register(cx.waker());
Expand Down

0 comments on commit 9a45d77

Please sign in to comment.