rust-embedded-community / embedded-nal

An Embedded Network Abstraction Layer
Apache License 2.0
177 stars 25 forks source link

Add blanket impls for mutable references #60

Closed MathiasKoch closed 2 years ago

MathiasKoch commented 2 years ago

I recently ran into an issue where i had a closure of signature F: FnOnce(&mut dyn TcpClientStack<TcpSocket = Handle, Error = Error>), which requires an impl of the embedded-nal traits for mutable references as impl<T: TcpClientStack> TcpClientStack for &mut T, in order to be used in functions like fn foo<T: TcpClientStack>(network: &mut T) { ... }.

This PR adds those blanket implementations for all the traits in this repo.

This is also in line with the agreed upon way in embedded-hal: https://github.com/rust-embedded/embedded-hal/pull/310

MathiasKoch commented 2 years ago

Ill just add a Changelog entry, and merge :+1: