Fix Send requirements for Wasm targets

This commit is contained in:
Héctor Ramón Jiménez 2024-06-14 01:52:30 +02:00
parent a25b1af456
commit b328da2c71
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
4 changed files with 7 additions and 7 deletions

View file

@ -8,7 +8,7 @@ pub use scrollable::Scrollable;
pub use text_input::TextInput; pub use text_input::TextInput;
use crate::widget::Id; use crate::widget::Id;
use crate::{MaybeSend, Rectangle, Vector}; use crate::{Rectangle, Vector};
use std::any::Any; use std::any::Any;
use std::fmt; use std::fmt;
@ -16,7 +16,7 @@ use std::sync::Arc;
/// A piece of logic that can traverse the widget tree of an application in /// A piece of logic that can traverse the widget tree of an application in
/// order to query or update some widget state. /// order to query or update some widget state.
pub trait Operation<T>: MaybeSend { pub trait Operation<T>: Send {
/// Operates on a widget that contains other widgets. /// Operates on a widget that contains other widgets.
/// ///
/// The `operate_on_children` function can be called to return control to /// The `operate_on_children` function can be called to return control to

View file

@ -52,7 +52,7 @@ impl<T> Task<T> {
/// its output. /// its output.
pub fn widget(operation: impl widget::Operation<T> + 'static) -> Task<T> pub fn widget(operation: impl widget::Operation<T> + 'static) -> Task<T>
where where
T: MaybeSend + 'static, T: Send + 'static,
{ {
Self::channel(move |sender| { Self::channel(move |sender| {
let operation = let operation =

View file

@ -7,7 +7,7 @@ use crate::core::time::Instant;
use crate::core::window::{ use crate::core::window::{
Event, Icon, Id, Level, Mode, Settings, UserAttention, Event, Icon, Id, Level, Mode, Settings, UserAttention,
}; };
use crate::core::{MaybeSend, Point, Size}; use crate::core::{Point, Size};
use crate::futures::event; use crate::futures::event;
use crate::futures::futures::channel::oneshot; use crate::futures::futures::channel::oneshot;
use crate::futures::Subscription; use crate::futures::Subscription;
@ -303,10 +303,10 @@ pub fn change_icon<T>(id: Id, icon: Icon) -> Task<T> {
/// Note that if the window closes before this call is processed the callback will not be run. /// Note that if the window closes before this call is processed the callback will not be run.
pub fn run_with_handle<T>( pub fn run_with_handle<T>(
id: Id, id: Id,
f: impl FnOnce(WindowHandle<'_>) -> T + MaybeSend + 'static, f: impl FnOnce(WindowHandle<'_>) -> T + Send + 'static,
) -> Task<T> ) -> Task<T>
where where
T: MaybeSend + 'static, T: Send + 'static,
{ {
Task::oneshot(move |channel| { Task::oneshot(move |channel| {
crate::Action::Window(Action::RunWithHandle( crate::Action::Window(Action::RunWithHandle(

View file

@ -202,7 +202,7 @@ where
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
is_booted: std::rc::Rc<std::cell::RefCell<bool>>, is_booted: std::rc::Rc<std::cell::RefCell<bool>>,
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
queued_events: Vec<winit::event::Event<Message>>, queued_events: Vec<winit::event::Event<Action<Message>>>,
} }
struct BootConfig<C> { struct BootConfig<C> {