Skip to content

Commit c7d8467

Browse files
committed
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.
1 parent 98a7173 commit c7d8467

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

graphics/src/widget/canvas/cache.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ impl Cache {
4949
/// Otherwise, the previously stored [`Geometry`] will be returned. The
5050
/// [`Cache`] is not cleared in this case. In other words, it will keep
5151
/// returning the stored [`Geometry`] if needed.
52-
pub fn draw(&self, bounds: Size, draw_fn: impl Fn(&mut Frame)) -> Geometry {
52+
pub fn draw(
53+
&self,
54+
bounds: Size,
55+
draw_fn: impl FnOnce(&mut Frame),
56+
) -> Geometry {
5357
use std::ops::Deref;
5458

5559
if let State::Filled {

0 commit comments

Comments
 (0)