FactbirdHQ / mqttrust

MQTT client for embedded devices, written in rust
53 stars 5 forks source link

Add ?Sized trait bound to all places requiring embedded-nal traits #38

Closed MathiasKoch closed 3 years ago

MathiasKoch commented 3 years ago

Add ?Sized trait bound to all places requiring embedded-nal traits, to relax sized requirement of mutable reference.

I recently ran into an issue where i had a closure of signature F: FnOnce(&mut dyn TcpClientStack<TcpSocket = Handle, Error = Error>), which removes the sized property of the TcpClientStack implementor.

This means that a &mut dyn TcpClientStack<TcpSocket = Handle, Error = Error> cannot be used in places like fn foo<T: TcpClientStack>(network: &mut T) { ... } without relaxing the requirement on Sized as fn foo<T: TcpClientStack + ?Sized>(network: &mut T) { ... }.

This PR adds those ?Sized, as we are not storing the references anywhere anyways.

codecov-commenter commented 3 years ago

Codecov Report

Merging #38 (3514d17) into master (724bc9a) will not change coverage. The diff coverage is 50.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #38   +/-   ##
=======================================
  Coverage   41.73%   41.73%           
=======================================
  Files          13       13           
  Lines        1174     1174           
  Branches      297      296    -1     
=======================================
  Hits          490      490           
  Misses        545      545           
  Partials      139      139           
Impacted Files Coverage Δ
mqttrust_core/src/state.rs 58.10% <ø> (ø)
mqttrust_core/src/eventloop.rs 38.23% <50.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 724bc9a...3514d17. Read the comment docs.