wezm / ssd1675

Rust driver for SSD1675 e-Paper display controller
Apache License 2.0
63 stars 14 forks source link

reasoning for GraphicsDisplay not taking ownership of the byte buffers? #6

Closed jedahan closed 2 years ago

jedahan commented 5 years ago

Hi again!

Is there a reason GraphicsDisplay::new takes a reference to black_buffer and color_buffer as opposed to taking ownership?

I am trying to write a struct that wraps GraphicsDisplay::new, and in my LCD::new create the buffers, but having a hard time with the compiler (rightfully) complaining that my buffers are going to be dropped at the end of the function, since GraphicsDisplay::new is only borrowing them.

wezm commented 5 years ago

That's a good question... looking over the code I don't think there is a good reason. It seems moving them would be better. BTW I haven't forgotten about #4 just been very busy prepping a project for linux.conf.au next week.