pub trait StreamingHandler {
// Required method
fn write_all(
self: Box<Self>,
sink: &mut StreamingHandlerSink<'_>,
) -> Result<(), Box<dyn StdError + Send + Sync>>;
}
Expand description
A callback used to write content asynchronously.
Use the streaming!
macro to construct it.
Required Methods§
Sourcefn write_all(
self: Box<Self>,
sink: &mut StreamingHandlerSink<'_>,
) -> Result<(), Box<dyn StdError + Send + Sync>>
fn write_all( self: Box<Self>, sink: &mut StreamingHandlerSink<'_>, ) -> Result<(), Box<dyn StdError + Send + Sync>>
This method is called only once, and is expected to write content
by calling the sink.write_str()
one or more times.
Multiple calls to sink.write_str()
append more content to the output.
See StreamingHandlerSink
.
Note: if you get “implementation of FnOnce
is not general enough” error, add explicit argument
sink: &mut StreamingHandlerSink<'_>
to the closure.