From d3229370f3a4912667b77e8db8e25d6bda89a900 Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 12 Jul 2022 10:09:45 +0200 Subject: [PATCH] Consume widget during rendering --- src/ui/widgets.rs | 2 +- src/ui/widgets/text.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/widgets.rs b/src/ui/widgets.rs index bdb0809..63c9092 100644 --- a/src/ui/widgets.rs +++ b/src/ui/widgets.rs @@ -7,5 +7,5 @@ use toss::frame::{Frame, Pos, Size}; pub trait Widget { fn size(&self, frame: &mut Frame, max_width: Option, max_height: Option) -> Size; - async fn render(&self, frame: &mut Frame, pos: Pos, size: Size); + async fn render(self, frame: &mut Frame, pos: Pos, size: Size); } diff --git a/src/ui/widgets/text.rs b/src/ui/widgets/text.rs index 267f447..d7ee938 100644 --- a/src/ui/widgets/text.rs +++ b/src/ui/widgets/text.rs @@ -47,7 +47,7 @@ impl Widget for Text { Size::new(min_width as u16, min_height as u16) } - async fn render(&self, frame: &mut Frame, pos: Pos, size: Size) { + async fn render(self, frame: &mut Frame, pos: Pos, size: Size) { for (i, line) in self .wrapped(frame, Some(size.width)) .into_iter()