From 784fa80c0d92a7d1fda8a7ff77185d50423e228a Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 17 Mar 2024 17:57:24 +0100 Subject: Use `Program` API in `todos` example --- src/application/program.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/application/program.rs b/src/application/program.rs index d70f39cf..2e77678e 100644 --- a/src/application/program.rs +++ b/src/application/program.rs @@ -32,7 +32,7 @@ use crate::application::{self, Application}; use crate::executor::{self, Executor}; use crate::window; -use crate::{Command, Element, Font, Result, Settings, Subscription}; +use crate::{Command, Element, Font, Result, Settings, Size, Subscription}; use std::borrow::Cow; @@ -277,6 +277,20 @@ impl Program

{ } } + /// Sets the [`window::Settings::size`] of the [`Program`]. + pub fn window_size(self, size: impl Into) -> Self { + Self { + settings: Settings { + window: window::Settings { + size: size.into(), + ..self.settings.window + }, + ..self.settings + }, + ..self + } + } + /// Sets the [`window::Settings::transparent`] of the [`Program`]. pub fn transparent(self, transparent: bool) -> Self { Self { -- cgit