diff options
author | 2023-02-06 09:05:07 -0700 | |
---|---|---|
committer | 2023-02-06 09:05:07 -0700 | |
commit | c7d8467c46e519b28f8f630061e7d55fb3cd3f8b (patch) | |
tree | d4b9edcea30bcf858ea2638d5fe1f2c561860d2e /graphics | |
parent | 98a717383acf71d7939d7cc90d350743487f0380 (diff) | |
download | iced-c7d8467c46e519b28f8f630061e7d55fb3cd3f8b.tar.gz iced-c7d8467c46e519b28f8f630061e7d55fb3cd3f8b.tar.bz2 iced-c7d8467c46e519b28f8f630061e7d55fb3cd3f8b.zip |
Accept FnOnce instead of Fn in canvas cache draw
Use FnOnce in `draw` function signature instead of `Fn`, permitting the
use of iterators and other one-time functions.
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/src/widget/canvas/cache.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/graphics/src/widget/canvas/cache.rs b/graphics/src/widget/canvas/cache.rs index 49873ac9..52217bbb 100644 --- a/graphics/src/widget/canvas/cache.rs +++ b/graphics/src/widget/canvas/cache.rs @@ -49,7 +49,11 @@ impl Cache { /// Otherwise, the previously stored [`Geometry`] will be returned. The /// [`Cache`] is not cleared in this case. In other words, it will keep /// returning the stored [`Geometry`] if needed. - pub fn draw(&self, bounds: Size, draw_fn: impl Fn(&mut Frame)) -> Geometry { + pub fn draw( + &self, + bounds: Size, + draw_fn: impl FnOnce(&mut Frame), + ) -> Geometry { use std::ops::Deref; if let State::Filled { |