Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove Sync bound for Message #121

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub trait Application: Sized {
type Executor: Executor;

/// The type of __messages__ your [`Application`] will produce.
type Message: std::fmt::Debug + Send + Sync + 'static;
type Message: std::fmt::Debug + Send + 'static;

/// The theme of your [`Application`].
type Theme: Default + StyleSheet;
Expand Down
2 changes: 1 addition & 1 deletion src/multi_window/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub trait Application: Sized {
type Executor: Executor;

/// The type of __messages__ your [`Application`] will produce.
type Message: std::fmt::Debug + Send + Sync + 'static;
type Message: std::fmt::Debug + Send + 'static;

/// The theme of your [`Application`].
type Theme: Default + StyleSheet;
Expand Down
4 changes: 1 addition & 3 deletions winit/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ pub enum UserEventWrapper<Message> {
}

unsafe impl<M> Send for UserEventWrapper<M> {}
unsafe impl<M> Sync for UserEventWrapper<M> {}

impl<M: std::fmt::Debug> std::fmt::Debug for UserEventWrapper<M> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Expand Down Expand Up @@ -194,7 +193,6 @@ where
E: Executor + 'static,
C: Compositor<Renderer = A::Renderer> + 'static,
A::Theme: StyleSheet,
<A>::Message: Sync,
{
use futures::task;
use futures::Future;
Expand Down Expand Up @@ -357,7 +355,7 @@ async fn run_instance<A, E, C>(
E: Executor + 'static,
C: Compositor<Renderer = A::Renderer> + 'static,
A::Theme: StyleSheet,
A::Message: Send + Sync + 'static,
A::Message: Send + 'static,
{
use winit::event;
use winit::event_loop::ControlFlow;
Expand Down
2 changes: 1 addition & 1 deletion winit/src/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::{any::Any, borrow::Cow};

use crate::futures::futures::Sink;

Check warning on line 5 in winit/src/clipboard.rs

View workflow job for this annotation

GitHub Actions / all

unused import: `crate::futures::futures::Sink`

Check warning on line 5 in winit/src/clipboard.rs

View workflow job for this annotation

GitHub Actions / all

unused import: `crate::futures::futures::Sink`
use dnd::{DndAction, DndDestinationRectangle, DndSurface, Icon};
use iced_style::core::clipboard::DndSource;
use window_clipboard::{
Expand All @@ -24,7 +24,7 @@
Unavailable,
}

impl<M: Send + Sync + 'static> Clipboard<M> {
impl<M: Send + 'static> Clipboard<M> {
/// Creates a new [`Clipboard`] for the given window.
pub fn connect(
window: &winit::window::Window,
Expand Down Expand Up @@ -98,11 +98,11 @@
}

impl<M> crate::core::Clipboard for Clipboard<M> {
fn read(&self) -> Option<String> {

Check warning on line 101 in winit/src/clipboard.rs

View workflow job for this annotation

GitHub Actions / all

function cannot return without recursing

Check warning on line 101 in winit/src/clipboard.rs

View workflow job for this annotation

GitHub Actions / all

function cannot return without recursing
self.read()
}

fn write(&mut self, contents: String) {

Check warning on line 105 in winit/src/clipboard.rs

View workflow job for this annotation

GitHub Actions / all

function cannot return without recursing

Check warning on line 105 in winit/src/clipboard.rs

View workflow job for this annotation

GitHub Actions / all

function cannot return without recursing
self.write(contents);
}

Expand Down Expand Up @@ -183,7 +183,7 @@
) {
match &self.state {
State::Connected(_, tx) => {
tx.raw.send_event(UserEventWrapper::StartDnd {

Check warning on line 186 in winit/src/clipboard.rs

View workflow job for this annotation

GitHub Actions / all

unused `Result` that must be used

Check warning on line 186 in winit/src/clipboard.rs

View workflow job for this annotation

GitHub Actions / all

unused `Result` that must be used
internal,
source_surface,
icon_surface,
Expand Down
8 changes: 4 additions & 4 deletions winit/src/multi_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ where
A: Application + 'static,
E: Executor + 'static,
C: Compositor<Renderer = A::Renderer> + 'static,
A::Message: Send + Sync + 'static,
A::Message: Send + 'static,
A::Theme: StyleSheet,
{
use winit::event_loop::EventLoopBuilder;
Expand Down Expand Up @@ -355,7 +355,7 @@ async fn run_instance<A, E, C>(
A: Application + 'static,
E: Executor + 'static,
C: Compositor<Renderer = A::Renderer> + 'static,
A::Message: Send + Sync + 'static,
A::Message: Send + 'static,
A::Theme: StyleSheet,
{
use winit::event;
Expand Down Expand Up @@ -1282,7 +1282,7 @@ fn update<A: Application + 'static, C, E: Executor + 'static>(
ui_caches: &mut HashMap<window::Id, user_interface::Cache>,
) where
C: Compositor<Renderer = A::Renderer> + 'static,
A::Message: Send + Sync + 'static,
A::Message: Send + 'static,
A::Theme: StyleSheet,
{
for message in messages.drain(..) {
Expand Down Expand Up @@ -1334,7 +1334,7 @@ fn run_command<A, C, E>(
A: Application,
E: Executor,
C: Compositor<Renderer = A::Renderer> + 'static,
A::Message: Send + Sync + 'static,
A::Message: Send + 'static,
A::Theme: StyleSheet,
{
use crate::runtime::clipboard;
Expand Down
Loading