gossamer/transform_stream/default_controller

Types

A controller passed to a TransformStream’s transformer callbacks. Used to enqueue output chunks, signal errors, or terminate the stream.

See TransformStreamDefaultController on MDN.

pub type DefaultController(a)

Values

pub fn desired_size(
  of controller: DefaultController(a),
) -> Result(Int, Nil)

The desired size to fill the readable side’s internal queue. Returns an error if the stream has been closed or errored.

pub fn enqueue(
  in controller: DefaultController(a),
  chunk chunk: a,
) -> Result(Nil, js_error.JsError)

Enqueues chunk into the readable side’s internal queue. Returns an error if the stream is closed or errored.

pub fn error(
  controller: DefaultController(a),
  reason reason: b,
) -> Result(Nil, js_error.JsError)

Signals an error on the stream. Returns an error if the stream is already closed or errored.

pub fn terminate(
  controller: DefaultController(a),
) -> Result(Nil, js_error.JsError)

Closes the readable side and errors the writable side of the stream. Returns an error if the stream is already closed or errored.

Search Document