Function mozjs::jsapi::JS::ReadableStreamGetDesiredSize

source ·
pub unsafe extern "C" fn ReadableStreamGetDesiredSize(
    cx: *mut JSContext,
    stream: *mut JSObject,
    hasValue: *mut bool,
    value: *mut f64,
) -> bool
Expand description

Retrieves the desired combined size of additional chunks to fill the given ReadableStream’s queue. Stores the result in |value| and sets |hasValue| to true on success, returns false on failure.

If the stream is errored, the call will succeed but no value will be stored in |value| and |hasValue| will be set to false.

Note: This is semantically equivalent to the |desiredSize| getter on the stream controller’s prototype in JS. We expose it with the stream itself as a target for simplicity.

Asserts that |stream| is a ReadableStream object or an unwrappable wrapper for one.