Menu

Struct

StreamResponder

kurogane::StreamResponderSource
pub struct StreamResponder { /* private fields */ }

Responder for sending data from a browser-side stream handler to the renderer.

A responder the runtime hands a handler is bound to its stream and its document. Once any clone has sent the stream’s end or error, or the stream is closed or its document has ended, every send returns Err.

Methods

#pub fn send_data(&self, data: &[u8]) -> Result<(), IpcError>

Sends a data chunk to the page’s onData.

Errors

Returns Err and sends nothing when the stream has ended or failed, or the document that opened it has gone (its frame navigated or closed).

#pub fn end(&self, result: &str) -> Result<(), IpcError>

Ends the stream. The page’s onEnd receives result.

The first end or error sent, from any clone, closes the stream.

Errors

As send_data; the error’s message is stream closed once the stream has ended or failed.

#pub fn error(&self, error: impl Into<IpcError>) -> Result<(), IpcError>

Fails the stream. The page’s onError receives the error’s message. A string is an IpcError::new.

Closes the stream, as end does.

Errors

As end.

Trait implementations