From bb71e8481ed59f991b9bd9dc55ea7e011ba0aac6 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 16 Mar 2024 16:12:07 +0100 Subject: Make `sandbox` helper take a `title` as well --- src/lib.rs | 2 +- src/program.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 19815f0f..cda5341c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -370,7 +370,7 @@ where State: Default + 'static, Message: std::fmt::Debug + Send + 'static, { - sandbox(update, view).title(title).run() + sandbox(title, update, view).run() } #[doc(inline)] diff --git a/src/program.rs b/src/program.rs index 746f8f29..ab194a0d 100644 --- a/src/program.rs +++ b/src/program.rs @@ -15,8 +15,7 @@ //! use iced::Theme; //! //! pub fn main() -> iced::Result { -//! iced::sandbox(update, view) -//! .title("A counter") +//! iced::sandbox("A counter", update, view) //! .theme(|_| Theme::Dark) //! .centered() //! .run() @@ -54,7 +53,7 @@ use std::borrow::Cow; /// use iced::widget::{button, column, text, Column}; /// /// pub fn main() -> iced::Result { -/// iced::sandbox(update, view).title("A counter").run() +/// iced::sandbox("A counter", update, view).run() /// } /// /// #[derive(Debug, Clone)] @@ -76,6 +75,7 @@ use std::borrow::Cow; /// } /// ``` pub fn sandbox( + title: impl Title, update: impl Fn(&mut State, Message), view: impl for<'a> self::View<'a, State, Message>, ) -> Program< @@ -138,6 +138,7 @@ where }, settings: Settings::default(), } + .title(title) } /// Creates a [`Program`] that can leverage the [`Command`] API for -- cgit