stm32-rs / stm32-eth

Embedded Ethernet driver in Rust
Apache License 2.0
147 stars 47 forks source link

`smoltcp::Device` implementation can be for `EthernetDMA` instead of `&mut EthernetDMA` #86

Open datdenkikniet opened 1 year ago

datdenkikniet commented 1 year ago

The current implementation still has the following signature:

impl<'a, 'rx, 'tx> smoltcp::Device for &'a mut EthernetDMA<'rx, 'tx> {}

However, the 'a lifetime is completely unused. We could change the impl to

impl<'rx, 'tx> smoltcp::Device for EthernetDMA<'rx, 'tx> {}

We should investigate whether this is still necessary (unlikely), or if it is just an artifact from how the Device trait worked in smoltcp 0.8 and older (likely).

Removing that lifetime and impl-ing directly for EthernetDMA would also remove the current oddness w.r.t. requiring that an &mut &mut EthernetDMA is passed to smoltcp functions.