diff --git a/src/rewritable_units/element.rs b/src/rewritable_units/element.rs index acc7a88e..a96edf71 100644 --- a/src/rewritable_units/element.rs +++ b/src/rewritable_units/element.rs @@ -249,7 +249,7 @@ impl<'r, 't, H: HandlerTypes> Element<'r, 't, H> { /// Consequent calls to the method append to the previously inserted content. /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. - pub fn streaming_before(&mut self, string_writer: Box) { + pub fn streaming_before(&mut self, string_writer: Box) { self.start_tag .mutations .mutate() @@ -305,7 +305,7 @@ impl<'r, 't, H: HandlerTypes> Element<'r, 't, H> { /// /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. - pub fn streaming_after(&mut self, string_writer: Box) { + pub fn streaming_after(&mut self, string_writer: Box) { self.after_chunk(StringChunk::Stream(string_writer)); } @@ -369,7 +369,7 @@ impl<'r, 't, H: HandlerTypes> Element<'r, 't, H> { /// /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. - pub fn streaming_prepend(&mut self, string_writer: Box) { + pub fn streaming_prepend(&mut self, string_writer: Box) { self.prepend_chunk(StringChunk::Stream(string_writer)); } @@ -428,7 +428,7 @@ impl<'r, 't, H: HandlerTypes> Element<'r, 't, H> { /// [empty element]: https://developer.mozilla.org/en-US/docs/Glossary/Empty_element /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. - pub fn streaming_append(&mut self, string_writer: Box) { + pub fn streaming_append(&mut self, string_writer: Box) { self.append_chunk(StringChunk::Stream(string_writer)); } @@ -491,7 +491,7 @@ impl<'r, 't, H: HandlerTypes> Element<'r, 't, H> { /// /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. - pub fn streaming_set_inner_content(&mut self, string_writer: Box) { + pub fn streaming_set_inner_content(&mut self, string_writer: Box) { self.set_inner_content_chunk(StringChunk::Stream(string_writer)); } @@ -542,7 +542,7 @@ impl<'r, 't, H: HandlerTypes> Element<'r, 't, H> { /// /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. - pub fn streaming_replace(&mut self, string_writer: Box) { + pub fn streaming_replace(&mut self, string_writer: Box) { self.replace_chunk(StringChunk::Stream(string_writer)); } diff --git a/src/rewritable_units/mutations.rs b/src/rewritable_units/mutations.rs index 7e041f30..409a499d 100644 --- a/src/rewritable_units/mutations.rs +++ b/src/rewritable_units/mutations.rs @@ -86,7 +86,7 @@ impl Mutations { pub(crate) enum StringChunk { Buffer(Box, ContentType), - Stream(Box), + Stream(Box), } impl StringChunk { @@ -137,7 +137,7 @@ impl DynamicString { } /// A callback used to write content asynchronously. -pub trait StreamingHandler: Send { +pub trait StreamingHandler { /// This method is called only once, and is expected to write content /// by calling the [`sink.write_str()`](StreamingHandlerSink::write_str) one or more times. /// @@ -152,7 +152,7 @@ pub trait StreamingHandler: Send { impl RefUnwindSafe for StringChunk {} impl UnwindSafe for StringChunk {} -impl From for Box +impl From for Box where F: FnOnce(&mut StreamingHandlerSink<'_>) -> BoxResult + Send + 'static, { diff --git a/src/rewritable_units/tokens/comment.rs b/src/rewritable_units/tokens/comment.rs index def1748f..4ef4681e 100644 --- a/src/rewritable_units/tokens/comment.rs +++ b/src/rewritable_units/tokens/comment.rs @@ -120,7 +120,7 @@ impl<'i> Comment<'i> { /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. #[inline] - pub fn streaming_before(&mut self, string_writer: Box) { + pub fn streaming_before(&mut self, string_writer: Box) { self.mutations .mutate() .content_before @@ -168,7 +168,7 @@ impl<'i> Comment<'i> { /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. #[inline] - pub fn streaming_after(&mut self, string_writer: Box) { + pub fn streaming_after(&mut self, string_writer: Box) { self.mutations .mutate() .content_after @@ -215,7 +215,7 @@ impl<'i> Comment<'i> { /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. #[inline] - pub fn streaming_replace(&mut self, string_writer: Box) { + pub fn streaming_replace(&mut self, string_writer: Box) { self.mutations .mutate() .replace(StringChunk::Stream(string_writer)); diff --git a/src/rewritable_units/tokens/end_tag.rs b/src/rewritable_units/tokens/end_tag.rs index 4afffc5d..235ca64f 100644 --- a/src/rewritable_units/tokens/end_tag.rs +++ b/src/rewritable_units/tokens/end_tag.rs @@ -103,7 +103,7 @@ impl<'i> EndTag<'i> { /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. #[inline] - pub fn streaming_before(&mut self, string_writer: Box) { + pub fn streaming_before(&mut self, string_writer: Box) { self.mutations .mutate() .content_before @@ -116,7 +116,7 @@ impl<'i> EndTag<'i> { /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. #[inline] - pub fn streaming_after(&mut self, string_writer: Box) { + pub fn streaming_after(&mut self, string_writer: Box) { self.mutations .mutate() .content_after @@ -129,7 +129,7 @@ impl<'i> EndTag<'i> { /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. #[inline] - pub fn streaming_replace(&mut self, string_writer: Box) { + pub fn streaming_replace(&mut self, string_writer: Box) { self.mutations .mutate() .replace(StringChunk::Stream(string_writer)); diff --git a/src/rewritable_units/tokens/start_tag.rs b/src/rewritable_units/tokens/start_tag.rs index 1f96ec29..a808622a 100644 --- a/src/rewritable_units/tokens/start_tag.rs +++ b/src/rewritable_units/tokens/start_tag.rs @@ -145,7 +145,7 @@ impl<'i> StartTag<'i> { /// Consequent calls to the method append to the previously inserted content. /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. - pub fn streaming_before(&mut self, string_writer: Box) { + pub fn streaming_before(&mut self, string_writer: Box) { self.mutations .mutate() .content_before @@ -157,7 +157,7 @@ impl<'i> StartTag<'i> { /// Consequent calls to the method prepend to the previously inserted content. /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. - pub fn streaming_after(&mut self, string_writer: Box) { + pub fn streaming_after(&mut self, string_writer: Box) { self.mutations .mutate() .content_after @@ -169,7 +169,7 @@ impl<'i> StartTag<'i> { /// Consequent calls to the method overwrite previous replacement content. /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. - pub fn streaming_replace(&mut self, string_writer: Box) { + pub fn streaming_replace(&mut self, string_writer: Box) { self.mutations .mutate() .replace(StringChunk::Stream(string_writer)); diff --git a/src/rewritable_units/tokens/text_chunk.rs b/src/rewritable_units/tokens/text_chunk.rs index 0c653cd7..10ad1b3f 100644 --- a/src/rewritable_units/tokens/text_chunk.rs +++ b/src/rewritable_units/tokens/text_chunk.rs @@ -271,7 +271,7 @@ impl<'i> TextChunk<'i> { /// Consequent calls to the method append `content` to the previously inserted content. /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. - pub fn streaming_before(&mut self, string_writer: Box) { + pub fn streaming_before(&mut self, string_writer: Box) { self.mutations .mutate() .content_before @@ -283,7 +283,7 @@ impl<'i> TextChunk<'i> { /// Consequent calls to the method prepend to the previously inserted content. /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. - pub fn streaming_after(&mut self, string_writer: Box) { + pub fn streaming_after(&mut self, string_writer: Box) { self.mutations .mutate() .content_after @@ -295,7 +295,7 @@ impl<'i> TextChunk<'i> { /// Consequent calls to the method overwrite previous replacement content. /// /// Use the [`streaming!`] macro to make a `StreamingHandler` from a closure. - pub fn streaming_replace(&mut self, string_writer: Box) { + pub fn streaming_replace(&mut self, string_writer: Box) { self.mutations .mutate() .replace(StringChunk::Stream(string_writer)); diff --git a/src/rewriter/settings.rs b/src/rewriter/settings.rs index 92d1d5d2..e12114cf 100644 --- a/src/rewriter/settings.rs +++ b/src/rewriter/settings.rs @@ -538,13 +538,13 @@ macro_rules! streaming { ) -> StreamingHandler where StreamingHandler: - FnOnce(&mut StreamingHandlerSink<'_>) -> Result<(), Box> + 'static + Send, + FnOnce(&mut StreamingHandlerSink<'_>) -> Result<(), Box> + 'static, { handler_closure } Box::new(streaming_macro_type_hint($closure)) - as Box + as Box }}; }