Remove load method from application and daemon
If you need to run a `Task` during boot, use `run_with` instead!
This commit is contained in:
parent
3d99da805d
commit
e86920be5b
10 changed files with 70 additions and 197 deletions
|
|
@ -10,6 +10,6 @@ iced.workspace = true
|
||||||
iced.features = ["tokio"]
|
iced.features = ["tokio"]
|
||||||
|
|
||||||
[dependencies.reqwest]
|
[dependencies.reqwest]
|
||||||
version = "0.11"
|
version = "0.12"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["rustls-tls"]
|
features = ["rustls-tls"]
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,11 @@ use std::sync::Arc;
|
||||||
|
|
||||||
pub fn main() -> iced::Result {
|
pub fn main() -> iced::Result {
|
||||||
iced::application("Editor - Iced", Editor::update, Editor::view)
|
iced::application("Editor - Iced", Editor::update, Editor::view)
|
||||||
.load(Editor::load)
|
|
||||||
.subscription(Editor::subscription)
|
.subscription(Editor::subscription)
|
||||||
.theme(Editor::theme)
|
.theme(Editor::theme)
|
||||||
.font(include_bytes!("../fonts/icons.ttf").as_slice())
|
.font(include_bytes!("../fonts/icons.ttf").as_slice())
|
||||||
.default_font(Font::MONOSPACE)
|
.default_font(Font::MONOSPACE)
|
||||||
.run()
|
.run_with(Editor::new)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Editor {
|
struct Editor {
|
||||||
|
|
@ -41,20 +40,22 @@ enum Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Editor {
|
impl Editor {
|
||||||
fn new() -> Self {
|
fn new() -> (Self, Task<Message>) {
|
||||||
Self {
|
(
|
||||||
file: None,
|
Self {
|
||||||
content: text_editor::Content::new(),
|
file: None,
|
||||||
theme: highlighter::Theme::SolarizedDark,
|
content: text_editor::Content::new(),
|
||||||
is_loading: true,
|
theme: highlighter::Theme::SolarizedDark,
|
||||||
is_dirty: false,
|
is_loading: true,
|
||||||
}
|
is_dirty: false,
|
||||||
}
|
},
|
||||||
|
Task::perform(
|
||||||
fn load() -> Task<Message> {
|
load_file(format!(
|
||||||
Task::perform(
|
"{}/src/main.rs",
|
||||||
load_file(format!("{}/src/main.rs", env!("CARGO_MANIFEST_DIR"))),
|
env!("CARGO_MANIFEST_DIR")
|
||||||
Message::FileOpened,
|
)),
|
||||||
|
Message::FileOpened,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -214,12 +215,6 @@ impl Editor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Editor {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
DialogClosed,
|
DialogClosed,
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,12 @@ use std::collections::BTreeMap;
|
||||||
|
|
||||||
fn main() -> iced::Result {
|
fn main() -> iced::Result {
|
||||||
iced::daemon(Example::title, Example::update, Example::view)
|
iced::daemon(Example::title, Example::update, Example::view)
|
||||||
.load(|| {
|
|
||||||
window::open(window::Settings::default()).map(Message::WindowOpened)
|
|
||||||
})
|
|
||||||
.subscription(Example::subscription)
|
.subscription(Example::subscription)
|
||||||
.theme(Example::theme)
|
.theme(Example::theme)
|
||||||
.scale_factor(Example::scale_factor)
|
.scale_factor(Example::scale_factor)
|
||||||
.run()
|
.run_with(Example::new)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
struct Example {
|
struct Example {
|
||||||
windows: BTreeMap<window::Id, Window>,
|
windows: BTreeMap<window::Id, Window>,
|
||||||
}
|
}
|
||||||
|
|
@ -43,6 +39,16 @@ enum Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Example {
|
impl Example {
|
||||||
|
fn new() -> (Self, Task<Message>) {
|
||||||
|
(
|
||||||
|
Self {
|
||||||
|
windows: BTreeMap::new(),
|
||||||
|
},
|
||||||
|
window::open(window::Settings::default())
|
||||||
|
.map(Message::WindowOpened),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fn title(&self, window: window::Id) -> String {
|
fn title(&self, window: window::Id) -> String {
|
||||||
self.windows
|
self.windows
|
||||||
.get(&window)
|
.get(&window)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ version = "1.0"
|
||||||
features = ["derive"]
|
features = ["derive"]
|
||||||
|
|
||||||
[dependencies.reqwest]
|
[dependencies.reqwest]
|
||||||
version = "0.11"
|
version = "0.12"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["json", "rustls-tls"]
|
features = ["json", "rustls-tls"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,13 @@ use iced::{Alignment, Element, Length, Task};
|
||||||
|
|
||||||
pub fn main() -> iced::Result {
|
pub fn main() -> iced::Result {
|
||||||
iced::application(Pokedex::title, Pokedex::update, Pokedex::view)
|
iced::application(Pokedex::title, Pokedex::update, Pokedex::view)
|
||||||
.load(Pokedex::search)
|
.run_with(Pokedex::new)
|
||||||
.run()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug)]
|
||||||
enum Pokedex {
|
enum Pokedex {
|
||||||
#[default]
|
|
||||||
Loading,
|
Loading,
|
||||||
Loaded {
|
Loaded { pokemon: Pokemon },
|
||||||
pokemon: Pokemon,
|
|
||||||
},
|
|
||||||
Errored,
|
Errored,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -25,6 +21,10 @@ enum Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Pokedex {
|
impl Pokedex {
|
||||||
|
fn new() -> (Self, Task<Message>) {
|
||||||
|
(Self::Loading, Self::search())
|
||||||
|
}
|
||||||
|
|
||||||
fn search() -> Task<Message> {
|
fn search() -> Task<Message> {
|
||||||
Task::perform(Pokemon::search(), Message::PokemonFound)
|
Task::perform(Pokemon::search(), Message::PokemonFound)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,14 @@ pub fn main() -> iced::Result {
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
|
|
||||||
iced::application(Todos::title, Todos::update, Todos::view)
|
iced::application(Todos::title, Todos::update, Todos::view)
|
||||||
.load(Todos::load)
|
|
||||||
.subscription(Todos::subscription)
|
.subscription(Todos::subscription)
|
||||||
.font(include_bytes!("../fonts/icons.ttf").as_slice())
|
.font(include_bytes!("../fonts/icons.ttf").as_slice())
|
||||||
.window_size((500.0, 800.0))
|
.window_size((500.0, 800.0))
|
||||||
.run()
|
.run_with(Todos::new)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug)]
|
#[derive(Debug)]
|
||||||
enum Todos {
|
enum Todos {
|
||||||
#[default]
|
|
||||||
Loading,
|
Loading,
|
||||||
Loaded(State),
|
Loaded(State),
|
||||||
}
|
}
|
||||||
|
|
@ -54,8 +52,11 @@ enum Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Todos {
|
impl Todos {
|
||||||
fn load() -> Command<Message> {
|
fn new() -> (Self, Command<Message>) {
|
||||||
Command::perform(SavedState::load(), Message::Loaded)
|
(
|
||||||
|
Self::Loading,
|
||||||
|
Command::perform(SavedState::load(), Message::Loaded),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn title(&self) -> String {
|
fn title(&self) -> String {
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,10 @@ use once_cell::sync::Lazy;
|
||||||
|
|
||||||
pub fn main() -> iced::Result {
|
pub fn main() -> iced::Result {
|
||||||
iced::application("WebSocket - Iced", WebSocket::update, WebSocket::view)
|
iced::application("WebSocket - Iced", WebSocket::update, WebSocket::view)
|
||||||
.load(WebSocket::load)
|
|
||||||
.subscription(WebSocket::subscription)
|
.subscription(WebSocket::subscription)
|
||||||
.run()
|
.run_with(WebSocket::new)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
struct WebSocket {
|
struct WebSocket {
|
||||||
messages: Vec<echo::Message>,
|
messages: Vec<echo::Message>,
|
||||||
new_message: String,
|
new_message: String,
|
||||||
|
|
@ -30,11 +28,18 @@ enum Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WebSocket {
|
impl WebSocket {
|
||||||
fn load() -> Task<Message> {
|
fn new() -> (Self, Task<Message>) {
|
||||||
Task::batch([
|
(
|
||||||
Task::perform(echo::server::run(), |_| Message::Server),
|
Self {
|
||||||
widget::focus_next(),
|
messages: Vec::new(),
|
||||||
])
|
new_message: String::new(),
|
||||||
|
state: State::Disconnected,
|
||||||
|
},
|
||||||
|
Task::batch([
|
||||||
|
Task::perform(echo::server::run(), |_| Message::Server),
|
||||||
|
widget::focus_next(),
|
||||||
|
]),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, message: Message) -> Task<Message> {
|
fn update(&mut self, message: Message) -> Task<Message> {
|
||||||
|
|
@ -140,10 +145,4 @@ enum State {
|
||||||
Connected(echo::Connection),
|
Connected(echo::Connection),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for State {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Disconnected
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static MESSAGE_LOG: Lazy<scrollable::Id> = Lazy::new(scrollable::Id::unique);
|
static MESSAGE_LOG: Lazy<scrollable::Id> = Lazy::new(scrollable::Id::unique);
|
||||||
|
|
|
||||||
|
|
@ -103,10 +103,6 @@ where
|
||||||
type Renderer = Renderer;
|
type Renderer = Renderer;
|
||||||
type Executor = iced_futures::backend::default::Executor;
|
type Executor = iced_futures::backend::default::Executor;
|
||||||
|
|
||||||
fn load(&self) -> Task<Self::Message> {
|
|
||||||
Task::none()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update(
|
fn update(
|
||||||
&self,
|
&self,
|
||||||
state: &mut Self::State,
|
state: &mut Self::State,
|
||||||
|
|
@ -166,14 +162,14 @@ impl<P: Program> Application<P> {
|
||||||
Self: 'static,
|
Self: 'static,
|
||||||
P::State: Default,
|
P::State: Default,
|
||||||
{
|
{
|
||||||
self.run_with(P::State::default)
|
self.raw.run(self.settings, Some(self.window))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Runs the [`Application`] with a closure that creates the initial state.
|
/// Runs the [`Application`] with a closure that creates the initial state.
|
||||||
pub fn run_with<I>(self, initialize: I) -> Result
|
pub fn run_with<I>(self, initialize: I) -> Result
|
||||||
where
|
where
|
||||||
Self: 'static,
|
Self: 'static,
|
||||||
I: Fn() -> P::State + Clone + 'static,
|
I: Fn() -> (P::State, Task<P::Message>) + Clone + 'static,
|
||||||
{
|
{
|
||||||
self.raw
|
self.raw
|
||||||
.run_with(self.settings, Some(self.window), initialize)
|
.run_with(self.settings, Some(self.window), initialize)
|
||||||
|
|
@ -323,20 +319,6 @@ impl<P: Program> Application<P> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Runs the [`Task`] produced by the closure at startup.
|
|
||||||
pub fn load(
|
|
||||||
self,
|
|
||||||
f: impl Fn() -> Task<P::Message>,
|
|
||||||
) -> Application<
|
|
||||||
impl Program<State = P::State, Message = P::Message, Theme = P::Theme>,
|
|
||||||
> {
|
|
||||||
Application {
|
|
||||||
raw: program::with_load(self.raw, f),
|
|
||||||
settings: self.settings,
|
|
||||||
window: self.window,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Sets the subscription logic of the [`Application`].
|
/// Sets the subscription logic of the [`Application`].
|
||||||
pub fn subscription(
|
pub fn subscription(
|
||||||
self,
|
self,
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,6 @@ where
|
||||||
type Renderer = Renderer;
|
type Renderer = Renderer;
|
||||||
type Executor = iced_futures::backend::default::Executor;
|
type Executor = iced_futures::backend::default::Executor;
|
||||||
|
|
||||||
fn load(&self) -> Task<Self::Message> {
|
|
||||||
Task::none()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update(
|
fn update(
|
||||||
&self,
|
&self,
|
||||||
state: &mut Self::State,
|
state: &mut Self::State,
|
||||||
|
|
@ -116,14 +112,14 @@ impl<P: Program> Daemon<P> {
|
||||||
Self: 'static,
|
Self: 'static,
|
||||||
P::State: Default,
|
P::State: Default,
|
||||||
{
|
{
|
||||||
self.run_with(P::State::default)
|
self.raw.run(self.settings, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Runs the [`Daemon`] with a closure that creates the initial state.
|
/// Runs the [`Daemon`] with a closure that creates the initial state.
|
||||||
pub fn run_with<I>(self, initialize: I) -> Result
|
pub fn run_with<I>(self, initialize: I) -> Result
|
||||||
where
|
where
|
||||||
Self: 'static,
|
Self: 'static,
|
||||||
I: Fn() -> P::State + Clone + 'static,
|
I: Fn() -> (P::State, Task<P::Message>) + Clone + 'static,
|
||||||
{
|
{
|
||||||
self.raw.run_with(self.settings, None, initialize)
|
self.raw.run_with(self.settings, None, initialize)
|
||||||
}
|
}
|
||||||
|
|
@ -176,19 +172,6 @@ impl<P: Program> Daemon<P> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Runs the [`Task`] produced by the closure at startup.
|
|
||||||
pub fn load(
|
|
||||||
self,
|
|
||||||
f: impl Fn() -> Task<P::Message>,
|
|
||||||
) -> Daemon<
|
|
||||||
impl Program<State = P::State, Message = P::Message, Theme = P::Theme>,
|
|
||||||
> {
|
|
||||||
Daemon {
|
|
||||||
raw: program::with_load(self.raw, f),
|
|
||||||
settings: self.settings,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Sets the subscription logic of the [`Daemon`].
|
/// Sets the subscription logic of the [`Daemon`].
|
||||||
pub fn subscription(
|
pub fn subscription(
|
||||||
self,
|
self,
|
||||||
|
|
|
||||||
111
src/program.rs
111
src/program.rs
|
|
@ -27,8 +27,6 @@ pub trait Program: Sized {
|
||||||
/// The executor of the program.
|
/// The executor of the program.
|
||||||
type Executor: Executor;
|
type Executor: Executor;
|
||||||
|
|
||||||
fn load(&self) -> Task<Self::Message>;
|
|
||||||
|
|
||||||
fn update(
|
fn update(
|
||||||
&self,
|
&self,
|
||||||
state: &mut Self::State,
|
state: &mut Self::State,
|
||||||
|
|
@ -80,7 +78,9 @@ pub trait Program: Sized {
|
||||||
Self: 'static,
|
Self: 'static,
|
||||||
Self::State: Default,
|
Self::State: Default,
|
||||||
{
|
{
|
||||||
self.run_with(settings, window_settings, Self::State::default)
|
self.run_with(settings, window_settings, || {
|
||||||
|
(Self::State::default(), Task::none())
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Runs the [`Program`] with the given [`Settings`] and a closure that creates the initial state.
|
/// Runs the [`Program`] with the given [`Settings`] and a closure that creates the initial state.
|
||||||
|
|
@ -92,7 +92,7 @@ pub trait Program: Sized {
|
||||||
) -> Result
|
) -> Result
|
||||||
where
|
where
|
||||||
Self: 'static,
|
Self: 'static,
|
||||||
I: Fn() -> Self::State + Clone + 'static,
|
I: Fn() -> (Self::State, Task<Self::Message>) + Clone + 'static,
|
||||||
{
|
{
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
|
|
@ -102,7 +102,9 @@ pub trait Program: Sized {
|
||||||
_initialize: PhantomData<I>,
|
_initialize: PhantomData<I>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<P: Program, I: Fn() -> P::State> shell::Program for Instance<P, I> {
|
impl<P: Program, I: Fn() -> (P::State, Task<P::Message>)> shell::Program
|
||||||
|
for Instance<P, I>
|
||||||
|
{
|
||||||
type Message = P::Message;
|
type Message = P::Message;
|
||||||
type Theme = P::Theme;
|
type Theme = P::Theme;
|
||||||
type Renderer = P::Renderer;
|
type Renderer = P::Renderer;
|
||||||
|
|
@ -112,8 +114,7 @@ pub trait Program: Sized {
|
||||||
fn new(
|
fn new(
|
||||||
(program, initialize): Self::Flags,
|
(program, initialize): Self::Flags,
|
||||||
) -> (Self, Task<Self::Message>) {
|
) -> (Self, Task<Self::Message>) {
|
||||||
let state = initialize();
|
let (state, task) = initialize();
|
||||||
let command = program.load();
|
|
||||||
|
|
||||||
(
|
(
|
||||||
Self {
|
Self {
|
||||||
|
|
@ -121,7 +122,7 @@ pub trait Program: Sized {
|
||||||
state,
|
state,
|
||||||
_initialize: PhantomData,
|
_initialize: PhantomData,
|
||||||
},
|
},
|
||||||
command,
|
task,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -212,10 +213,6 @@ pub fn with_title<P: Program>(
|
||||||
type Renderer = P::Renderer;
|
type Renderer = P::Renderer;
|
||||||
type Executor = P::Executor;
|
type Executor = P::Executor;
|
||||||
|
|
||||||
fn load(&self) -> Task<Self::Message> {
|
|
||||||
self.program.load()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn title(&self, state: &Self::State, window: window::Id) -> String {
|
fn title(&self, state: &Self::State, window: window::Id) -> String {
|
||||||
(self.title)(state, window)
|
(self.title)(state, window)
|
||||||
}
|
}
|
||||||
|
|
@ -267,80 +264,6 @@ pub fn with_title<P: Program>(
|
||||||
WithTitle { program, title }
|
WithTitle { program, title }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_load<P: Program>(
|
|
||||||
program: P,
|
|
||||||
f: impl Fn() -> Task<P::Message>,
|
|
||||||
) -> impl Program<State = P::State, Message = P::Message, Theme = P::Theme> {
|
|
||||||
struct WithLoad<P, F> {
|
|
||||||
program: P,
|
|
||||||
load: F,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<P: Program, F> Program for WithLoad<P, F>
|
|
||||||
where
|
|
||||||
F: Fn() -> Task<P::Message>,
|
|
||||||
{
|
|
||||||
type State = P::State;
|
|
||||||
type Message = P::Message;
|
|
||||||
type Theme = P::Theme;
|
|
||||||
type Renderer = P::Renderer;
|
|
||||||
type Executor = P::Executor;
|
|
||||||
|
|
||||||
fn load(&self) -> Task<Self::Message> {
|
|
||||||
Task::batch([self.program.load(), (self.load)()])
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update(
|
|
||||||
&self,
|
|
||||||
state: &mut Self::State,
|
|
||||||
message: Self::Message,
|
|
||||||
) -> Task<Self::Message> {
|
|
||||||
self.program.update(state, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn view<'a>(
|
|
||||||
&self,
|
|
||||||
state: &'a Self::State,
|
|
||||||
window: window::Id,
|
|
||||||
) -> Element<'a, Self::Message, Self::Theme, Self::Renderer> {
|
|
||||||
self.program.view(state, window)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn title(&self, state: &Self::State, window: window::Id) -> String {
|
|
||||||
self.program.title(state, window)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn subscription(
|
|
||||||
&self,
|
|
||||||
state: &Self::State,
|
|
||||||
) -> Subscription<Self::Message> {
|
|
||||||
self.program.subscription(state)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn theme(
|
|
||||||
&self,
|
|
||||||
state: &Self::State,
|
|
||||||
window: window::Id,
|
|
||||||
) -> Self::Theme {
|
|
||||||
self.program.theme(state, window)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn style(
|
|
||||||
&self,
|
|
||||||
state: &Self::State,
|
|
||||||
theme: &Self::Theme,
|
|
||||||
) -> Appearance {
|
|
||||||
self.program.style(state, theme)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn scale_factor(&self, state: &Self::State, window: window::Id) -> f64 {
|
|
||||||
self.program.scale_factor(state, window)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WithLoad { program, load: f }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn with_subscription<P: Program>(
|
pub fn with_subscription<P: Program>(
|
||||||
program: P,
|
program: P,
|
||||||
f: impl Fn(&P::State) -> Subscription<P::Message>,
|
f: impl Fn(&P::State) -> Subscription<P::Message>,
|
||||||
|
|
@ -367,10 +290,6 @@ pub fn with_subscription<P: Program>(
|
||||||
(self.subscription)(state)
|
(self.subscription)(state)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load(&self) -> Task<Self::Message> {
|
|
||||||
self.program.load()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update(
|
fn update(
|
||||||
&self,
|
&self,
|
||||||
state: &mut Self::State,
|
state: &mut Self::State,
|
||||||
|
|
@ -445,10 +364,6 @@ pub fn with_theme<P: Program>(
|
||||||
(self.theme)(state, window)
|
(self.theme)(state, window)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load(&self) -> Task<Self::Message> {
|
|
||||||
self.program.load()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn title(&self, state: &Self::State, window: window::Id) -> String {
|
fn title(&self, state: &Self::State, window: window::Id) -> String {
|
||||||
self.program.title(state, window)
|
self.program.title(state, window)
|
||||||
}
|
}
|
||||||
|
|
@ -519,10 +434,6 @@ pub fn with_style<P: Program>(
|
||||||
(self.style)(state, theme)
|
(self.style)(state, theme)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load(&self) -> Task<Self::Message> {
|
|
||||||
self.program.load()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn title(&self, state: &Self::State, window: window::Id) -> String {
|
fn title(&self, state: &Self::State, window: window::Id) -> String {
|
||||||
self.program.title(state, window)
|
self.program.title(state, window)
|
||||||
}
|
}
|
||||||
|
|
@ -585,10 +496,6 @@ pub fn with_scale_factor<P: Program>(
|
||||||
type Renderer = P::Renderer;
|
type Renderer = P::Renderer;
|
||||||
type Executor = P::Executor;
|
type Executor = P::Executor;
|
||||||
|
|
||||||
fn load(&self) -> Task<Self::Message> {
|
|
||||||
self.program.load()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn title(&self, state: &Self::State, window: window::Id) -> String {
|
fn title(&self, state: &Self::State, window: window::Id) -> String {
|
||||||
self.program.title(state, window)
|
self.program.title(state, window)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue