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.
This commit is contained in:
parent
98a717383a
commit
c7d8467c46
1 changed files with 5 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue