As I am new to Rust, I am not sure how to phrase the question meaningfully for future search and references, so I may need some help on the title.
Anyway, I have a piece of code implementing
rgb_img.scale(WIDTH/2, HEIGHT/2, false, true); frame.set_image(Some(rgb_img));
Which for my intent and purpose, works fine. However, I am trying to do a one-liner. Not sure it is an idiomatic way in Rust but anyway, the following code does not work:
frame.set_image(Some(rgb_img.scale(WIDTH/2, HEIGHT/2, false, true)));
frame.set_image(Some(rgb_img.scale(WIDTH/2, HEIGHT/2, false, true))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `fltk::ImageExt` is not implemented for `()`
So yeah, I presume it is due to the
scale method does to have the semi-colon in the end to catch the Unit-type value?
I mean 1 more line does not break the code or anything, but I am just curious.
Please enlighten me on this, and is there a one-liner solution to this? Thank you.