Rename Program::new to build

This commit is contained in:
Héctor Ramón Jiménez 2024-03-16 05:47:01 +01:00
parent c22269bff3
commit 5a986897d2
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -107,7 +107,7 @@ where
type Theme = crate::Theme; type Theme = crate::Theme;
type Executor = iced_futures::backend::null::Executor; type Executor = iced_futures::backend::null::Executor;
fn new(&self) -> (Self::State, Command<Self::Message>) { fn build(&self) -> (Self::State, Command<Self::Message>) {
(State::default(), Command::none()) (State::default(), Command::none())
} }
@ -176,7 +176,7 @@ where
type Theme = crate::Theme; type Theme = crate::Theme;
type Executor = executor::Default; type Executor = executor::Default;
fn new(&self) -> (Self::State, Command<Self::Message>) { fn build(&self) -> (Self::State, Command<Self::Message>) {
(self.new)() (self.new)()
} }
@ -240,7 +240,7 @@ impl<P: Definition> Program<P> {
type Executor = P::Executor; type Executor = P::Executor;
fn new(program: Self::Flags) -> (Self, Command<Self::Message>) { fn new(program: Self::Flags) -> (Self, Command<Self::Message>) {
let (state, command) = P::new(&program); let (state, command) = P::build(&program);
(Self { program, state }, command) (Self { program, state }, command)
} }
@ -414,7 +414,7 @@ pub trait Definition: Sized {
/// The executor of the program. /// The executor of the program.
type Executor: Executor; type Executor: Executor;
fn new(&self) -> (Self::State, Command<Self::Message>); fn build(&self) -> (Self::State, Command<Self::Message>);
fn update( fn update(
&self, &self,
@ -462,8 +462,8 @@ fn with_title<P: Definition>(
type Theme = P::Theme; type Theme = P::Theme;
type Executor = P::Executor; type Executor = P::Executor;
fn new(&self) -> (Self::State, Command<Self::Message>) { fn build(&self) -> (Self::State, Command<Self::Message>) {
self.program.new() self.program.build()
} }
fn title(&self, state: &Self::State) -> String { fn title(&self, state: &Self::State) -> String {
@ -525,8 +525,8 @@ fn with_subscription<P: Definition>(
(self.subscription)(state) (self.subscription)(state)
} }
fn new(&self) -> (Self::State, Command<Self::Message>) { fn build(&self) -> (Self::State, Command<Self::Message>) {
self.program.new() self.program.build()
} }
fn update( fn update(
@ -581,8 +581,8 @@ fn with_theme<P: Definition>(
(self.theme)(state) (self.theme)(state)
} }
fn new(&self) -> (Self::State, Command<Self::Message>) { fn build(&self) -> (Self::State, Command<Self::Message>) {
self.program.new() self.program.build()
} }
fn title(&self, state: &Self::State) -> String { fn title(&self, state: &Self::State) -> String {