diff --git a/typed-html/src/events.rs b/typed-html/src/events.rs
index b543c93..038619d 100644
--- a/typed-html/src/events.rs
+++ b/typed-html/src/events.rs
@@ -6,7 +6,7 @@ use std::fmt::{Display, Error, Formatter};
use std::iter;
/// Trait for event handlers.
-pub trait EventHandler {
+pub trait EventHandler {
/// Build a callback function from this event handler.
///
/// Returns `None` is this event handler can't be used to build a callback
@@ -26,13 +26,13 @@ pub trait EventHandler {
macro_rules! declare_events_struct {
($($name:ident,)*) => {
- pub struct Events {
+ pub struct Events where T: Send {
$(
pub $name: Option,
)*
}
- impl Events {
+ impl Events {
pub fn iter(&self) -> impl Iterator- {
iter::empty()
$(
@@ -54,7 +54,7 @@ macro_rules! declare_events_struct {
}
}
- impl IntoIterator for Events {
+ impl IntoIterator for Events {
type Item = (&'static str, T);
type IntoIter = Box>;
@@ -72,7 +72,7 @@ macro_rules! declare_events_struct {
}
}
- impl Default for Events {
+ impl Default for Events {
fn default() -> Self {
Events {
$(
@@ -82,7 +82,7 @@ macro_rules! declare_events_struct {
}
}
- impl Display for Events {
+ impl Display for Events {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
$(
if let Some(ref value) = self.$name {
diff --git a/typed-html/src/lib.rs b/typed-html/src/lib.rs
index ef53afe..de9a23b 100644
--- a/typed-html/src/lib.rs
+++ b/typed-html/src/lib.rs
@@ -214,11 +214,11 @@ pub mod types;
/// Marker trait for outputs
pub trait OutputType {
/// The type that contains events for this output.
- type Events: Default + Display;
+ type Events: Default + Display + Send;
/// The type of event targets for this output.
- type EventTarget;
+ type EventTarget: Send;
/// The type that's returned from attaching an event listener to a target.
- type EventListenerHandle;
+ type EventListenerHandle: Send;
}
/// String output
diff --git a/typed-html/src/output/stdweb.rs b/typed-html/src/output/stdweb.rs
index b2cc884..d96baf6 100644
--- a/typed-html/src/output/stdweb.rs
+++ b/typed-html/src/output/stdweb.rs
@@ -21,7 +21,7 @@ macro_rules! declare_events {
/// Container type for DOM events.
pub struct Events {
$(
- pub $name: Option>>,
+ pub $name: Option + Send>>,
)*
}
@@ -129,17 +129,17 @@ pub struct EFn(Option, PhantomData);
impl EFn
where
- F: FnMut(E) + 'static,
+ F: FnMut(E) + 'static + Send,
{
pub fn new(f: F) -> Self {
EFn(Some(f), PhantomData)
}
}
-impl From for Box>
+impl From for Box + Send>
where
- F: FnMut(E) + 'static,
- E: ConcreteEvent + 'static,
+ F: FnMut(E) + 'static + Send,
+ E: ConcreteEvent + 'static + Send,
{
fn from(f: F) -> Self {
Box::new(EFn::new(f))
@@ -148,8 +148,8 @@ where
impl EventHandler for EFn
where
- F: FnMut(E) + 'static,
- E: ConcreteEvent + 'static,
+ F: FnMut(E) + 'static + Send,
+ E: ConcreteEvent + 'static + Send,
{
fn attach(&mut self, target: &mut ::EventTarget) -> EventListenerHandle {
let handler = self.0.take().unwrap();