From 44436da495d5d079d5fc240528a000691c46e65e Mon Sep 17 00:00:00 2001 From: Matthew Nicholson Date: Sun, 31 Mar 2019 01:02:55 -0400 Subject: [PATCH] use the standard `From` trait instead of `IntoEventHandler` --- typed-html/src/output/stdweb.rs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/typed-html/src/output/stdweb.rs b/typed-html/src/output/stdweb.rs index dc37ed8..ec77c7a 100644 --- a/typed-html/src/output/stdweb.rs +++ b/typed-html/src/output/stdweb.rs @@ -6,7 +6,7 @@ use stdweb::web::{self, Element, EventListenerHandle, IElement, IEventTarget, IN use crate::OutputType; use crate::dom::VNode; -use crate::events::{EventHandler, IntoEventHandler}; +use crate::events::EventHandler; /// DOM output using the stdweb crate pub struct Stdweb; @@ -136,23 +136,13 @@ where } } -impl IntoEventHandler for F +impl From for Box> where F: FnMut(E) + 'static, E: ConcreteEvent + 'static, { - fn into_event_handler(self) -> Box> { - Box::new(EFn::new(self)) - } -} - -impl IntoEventHandler for EFn -where - F: FnMut(E) + 'static, - E: ConcreteEvent + 'static, -{ - fn into_event_handler(self) -> Box> { - Box::new(self) + fn from(f: F) -> Self { + Box::new(EFn::new(f)) } }