therealprof / display-interface

Rust crates providing a generic interface for display drivers and some default implementations (GPIO, SPI and I2C)
Apache License 2.0
73 stars 27 forks source link

Deconstructable trait #6

Closed bugadani closed 4 years ago

bugadani commented 4 years ago

This is an example implementation of how the destructors could be turned into a trait, as mentioned in #4

While possible, I'm not sure if this is useful, or has any added benefits on top of #5 Any feedback is appreciated.

therealprof commented 4 years ago

Hm, interesting. Thought I agree it might not actually be useful for real-world purposes. 😅

almindor commented 4 years ago

Cool I was about to do this! :+1:

I would make WriteOnlyCommand: Deconstructible to enforce its implementation.

Of course drivers should implement it too. We could technically enforce drivers to be Deconstructible by somehow binding DI functionality to a deconstructible caller but it seems overkill.

therealprof commented 4 years ago

@bugadani I don't think this provides any benefit over a good old custom release function which we've added in the just released 0.4.0 version so I'm going to close this now.