Skip to content

Commit

Permalink
Make Send and Sync supertraits of ElementHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
letmutex committed Jul 6, 2024
1 parent 0579eea commit 57450da
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/element_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use markup5ever_rcdom::Node;
use std::{collections::HashSet, rc::Rc};

/// The DOM element handler.
pub trait ElementHandler {
pub trait ElementHandler : Send + Sync {
fn append(&self) -> Option<String> {
None
}
Expand All @@ -47,13 +47,9 @@ pub(crate) struct HandlerRule {
pub(crate) handler: Box<dyn ElementHandler>,
}

unsafe impl Send for HandlerRule {}

unsafe impl Sync for HandlerRule {}

impl<F> ElementHandler for F
where
F: Fn(Element) -> Option<String>,
F: (Fn(Element) -> Option<String>) + Send + Sync,
{
fn on_visit(
&self,
Expand Down

0 comments on commit 57450da

Please sign in to comment.