Fix Send requirements in WebAssembly builds
This commit is contained in:
parent
4991a1a7f3
commit
5417b630a5
6 changed files with 14 additions and 20 deletions
|
|
@ -413,7 +413,7 @@ mod internal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "hot")]
|
#[cfg(all(feature = "hot", not(target_arch = "wasm32")))]
|
||||||
mod hot {
|
mod hot {
|
||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
use std::sync::atomic::{self, AtomicBool};
|
use std::sync::atomic::{self, AtomicBool};
|
||||||
|
|
@ -478,7 +478,7 @@ mod hot {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "hot"))]
|
#[cfg(any(not(feature = "hot"), target_arch = "wasm32"))]
|
||||||
mod hot {
|
mod hot {
|
||||||
pub fn init() {}
|
pub fn init() {}
|
||||||
|
|
||||||
|
|
@ -486,7 +486,7 @@ mod hot {
|
||||||
f()
|
f()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_hotpatch(_f: impl Fn() + Send + Sync + 'static) {}
|
pub fn on_hotpatch(_f: impl Fn()) {}
|
||||||
|
|
||||||
pub fn is_stale() -> bool {
|
pub fn is_stale() -> bool {
|
||||||
false
|
false
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ use crate::core::text;
|
||||||
use crate::core::theme;
|
use crate::core::theme;
|
||||||
use crate::core::window;
|
use crate::core::window;
|
||||||
use crate::core::{Element, Font, Settings};
|
use crate::core::{Element, Font, Settings};
|
||||||
use crate::futures::{Executor, MaybeSend, Subscription};
|
use crate::futures::{Executor, Subscription};
|
||||||
use crate::graphics::compositor;
|
use crate::graphics::compositor;
|
||||||
use crate::runtime::Task;
|
use crate::runtime::Task;
|
||||||
|
|
||||||
|
|
@ -29,7 +29,7 @@ pub trait Program: Sized {
|
||||||
type State;
|
type State;
|
||||||
|
|
||||||
/// The message of the program.
|
/// The message of the program.
|
||||||
type Message: MaybeSend + 'static;
|
type Message: Send + 'static;
|
||||||
|
|
||||||
/// The theme of the program.
|
/// The theme of the program.
|
||||||
type Theme: Default + theme::Base;
|
type Theme: Default + theme::Base;
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,7 @@ use crate::shell;
|
||||||
use crate::theme;
|
use crate::theme;
|
||||||
use crate::window;
|
use crate::window;
|
||||||
use crate::{
|
use crate::{
|
||||||
Element, Executor, Font, MaybeSend, Preset, Result, Settings, Size,
|
Element, Executor, Font, Preset, Result, Settings, Size, Subscription, Task,
|
||||||
Subscription, Task,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use iced_debug as debug;
|
use iced_debug as debug;
|
||||||
|
|
@ -83,7 +82,7 @@ pub fn application<State, Message, Theme, Renderer>(
|
||||||
) -> Application<impl Program<State = State, Message = Message, Theme = Theme>>
|
) -> Application<impl Program<State = State, Message = Message, Theme = Theme>>
|
||||||
where
|
where
|
||||||
State: 'static,
|
State: 'static,
|
||||||
Message: MaybeSend + 'static,
|
Message: Send + 'static,
|
||||||
Theme: Default + theme::Base,
|
Theme: Default + theme::Base,
|
||||||
Renderer: program::Renderer,
|
Renderer: program::Renderer,
|
||||||
{
|
{
|
||||||
|
|
@ -102,7 +101,7 @@ where
|
||||||
impl<State, Message, Theme, Renderer, Boot, Update, View> Program
|
impl<State, Message, Theme, Renderer, Boot, Update, View> Program
|
||||||
for Instance<State, Message, Theme, Renderer, Boot, Update, View>
|
for Instance<State, Message, Theme, Renderer, Boot, Update, View>
|
||||||
where
|
where
|
||||||
Message: MaybeSend + 'static,
|
Message: Send + 'static,
|
||||||
Theme: Default + theme::Base,
|
Theme: Default + theme::Base,
|
||||||
Renderer: program::Renderer,
|
Renderer: program::Renderer,
|
||||||
Boot: self::Boot<State, Message>,
|
Boot: self::Boot<State, Message>,
|
||||||
|
|
@ -201,7 +200,7 @@ impl<P: Program> Application<P> {
|
||||||
#[cfg(all(feature = "debug", not(feature = "tester")))]
|
#[cfg(all(feature = "debug", not(feature = "tester")))]
|
||||||
let program = iced_devtools::attach(self);
|
let program = iced_devtools::attach(self);
|
||||||
|
|
||||||
#[cfg(any(not(feature = "debug"), target_arch = "wasm32"))]
|
#[cfg(not(any(feature = "tester", feature = "debug")))]
|
||||||
let program = self;
|
let program = self;
|
||||||
|
|
||||||
Ok(shell::run(program)?)
|
Ok(shell::run(program)?)
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,7 @@ use crate::shell;
|
||||||
use crate::theme;
|
use crate::theme;
|
||||||
use crate::window;
|
use crate::window;
|
||||||
use crate::{
|
use crate::{
|
||||||
Element, Executor, Font, MaybeSend, Preset, Result, Settings, Subscription,
|
Element, Executor, Font, Preset, Result, Settings, Subscription, Task,
|
||||||
Task,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use iced_debug as debug;
|
use iced_debug as debug;
|
||||||
|
|
@ -31,7 +30,7 @@ pub fn daemon<State, Message, Theme, Renderer>(
|
||||||
) -> Daemon<impl Program<State = State, Message = Message, Theme = Theme>>
|
) -> Daemon<impl Program<State = State, Message = Message, Theme = Theme>>
|
||||||
where
|
where
|
||||||
State: 'static,
|
State: 'static,
|
||||||
Message: MaybeSend + 'static,
|
Message: Send + 'static,
|
||||||
Theme: Default + theme::Base,
|
Theme: Default + theme::Base,
|
||||||
Renderer: program::Renderer,
|
Renderer: program::Renderer,
|
||||||
{
|
{
|
||||||
|
|
@ -50,7 +49,7 @@ where
|
||||||
impl<State, Message, Theme, Renderer, Boot, Update, View> Program
|
impl<State, Message, Theme, Renderer, Boot, Update, View> Program
|
||||||
for Instance<State, Message, Theme, Renderer, Boot, Update, View>
|
for Instance<State, Message, Theme, Renderer, Boot, Update, View>
|
||||||
where
|
where
|
||||||
Message: MaybeSend + 'static,
|
Message: Send + 'static,
|
||||||
Theme: Default + theme::Base,
|
Theme: Default + theme::Base,
|
||||||
Renderer: program::Renderer,
|
Renderer: program::Renderer,
|
||||||
Boot: application::Boot<State, Message>,
|
Boot: application::Boot<State, Message>,
|
||||||
|
|
|
||||||
|
|
@ -528,7 +528,6 @@ pub use crate::core::{
|
||||||
pub use crate::program::Preset;
|
pub use crate::program::Preset;
|
||||||
pub use crate::program::message;
|
pub use crate::program::message;
|
||||||
pub use crate::runtime::exit;
|
pub use crate::runtime::exit;
|
||||||
pub use crate::runtime::futures::MaybeSend;
|
|
||||||
pub use iced_futures::Subscription;
|
pub use iced_futures::Subscription;
|
||||||
|
|
||||||
pub use Alignment::Center;
|
pub use Alignment::Center;
|
||||||
|
|
@ -698,7 +697,7 @@ pub fn run<State, Message, Theme, Renderer>(
|
||||||
) -> Result
|
) -> Result
|
||||||
where
|
where
|
||||||
State: Default + 'static,
|
State: Default + 'static,
|
||||||
Message: MaybeSend + message::MaybeDebug + message::MaybeClone + 'static,
|
Message: Send + message::MaybeDebug + message::MaybeClone + 'static,
|
||||||
Theme: Default + theme::Base + 'static,
|
Theme: Default + theme::Base + 'static,
|
||||||
Renderer: program::Renderer + 'static,
|
Renderer: program::Renderer + 'static,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -77,10 +77,7 @@ impl<T: 'static> Proxy<T> {
|
||||||
///
|
///
|
||||||
/// Note: This skips the backpressure mechanism with an unbounded
|
/// Note: This skips the backpressure mechanism with an unbounded
|
||||||
/// channel. Use sparingly!
|
/// channel. Use sparingly!
|
||||||
pub fn send(&self, value: T)
|
pub fn send(&self, value: T) {
|
||||||
where
|
|
||||||
T: std::fmt::Debug,
|
|
||||||
{
|
|
||||||
self.send_action(Action::Output(value));
|
self.send_action(Action::Output(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue