Make run_with take a FnOnce
This commit is contained in:
parent
950bfc07d4
commit
bdf0430880
3 changed files with 5 additions and 5 deletions
|
|
@ -169,7 +169,7 @@ impl<P: Program> Application<P> {
|
|||
pub fn run_with<I>(self, initialize: I) -> Result
|
||||
where
|
||||
Self: 'static,
|
||||
I: Fn() -> (P::State, Task<P::Message>) + Clone + 'static,
|
||||
I: FnOnce() -> (P::State, Task<P::Message>) + 'static,
|
||||
{
|
||||
self.raw
|
||||
.run_with(self.settings, Some(self.window), initialize)
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ impl<P: Program> Daemon<P> {
|
|||
pub fn run_with<I>(self, initialize: I) -> Result
|
||||
where
|
||||
Self: 'static,
|
||||
I: Fn() -> (P::State, Task<P::Message>) + Clone + 'static,
|
||||
I: FnOnce() -> (P::State, Task<P::Message>) + 'static,
|
||||
{
|
||||
self.raw.run_with(self.settings, None, initialize)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ pub trait Program: Sized {
|
|||
) -> Result
|
||||
where
|
||||
Self: 'static,
|
||||
I: Fn() -> (Self::State, Task<Self::Message>) + Clone + 'static,
|
||||
I: FnOnce() -> (Self::State, Task<Self::Message>) + 'static,
|
||||
{
|
||||
use std::marker::PhantomData;
|
||||
|
||||
|
|
@ -102,8 +102,8 @@ pub trait Program: Sized {
|
|||
_initialize: PhantomData<I>,
|
||||
}
|
||||
|
||||
impl<P: Program, I: Fn() -> (P::State, Task<P::Message>)> shell::Program
|
||||
for Instance<P, I>
|
||||
impl<P: Program, I: FnOnce() -> (P::State, Task<P::Message>)>
|
||||
shell::Program for Instance<P, I>
|
||||
{
|
||||
type Message = P::Message;
|
||||
type Theme = P::Theme;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue