#[repr(C)]
pub struct OptimizedEncodingListener { pub vtable_: *const OptimizedEncodingListener__bindgen_vtable, }
Expand description

The ConsumeStreamCallback is called from an active JSContext, passing a StreamConsumer that wishes to consume the given host object as a stream of bytes with the given MIME type. On failure, the embedding must report the appropriate error on ‘cx’. On success, the embedding must call consumer->consumeChunk() repeatedly on any thread until exactly one of:

  • consumeChunk() returns false
  • the embedding calls consumer->streamEnd()
  • the embedding calls consumer->streamError() before JS_DestroyContext(cx) or JS::ShutdownAsyncTasks(cx) is called.

Note: consumeChunk(), streamEnd() and streamError() may be called synchronously by ConsumeStreamCallback.

When streamEnd() is called, the embedding may optionally pass an OptimizedEncodingListener*, indicating that there is a cache entry associated with this stream that can store an optimized encoding of the bytes that were just streamed at some point in the future by having SpiderMonkey call storeOptimizedEncoding(). Until the optimized encoding is ready, SpiderMonkey will hold an outstanding refcount to keep the listener alive.

After storeOptimizedEncoding() is called, on cache hit, the embedding may call consumeOptimizedEncoding() instead of consumeChunk()/streamEnd(). The embedding must ensure that the GetOptimizedEncodingBuildId() (see js/BuildId.h) at the time when an optimized encoding is created is the same as when it is later consumed.

Fields§

§vtable_: *const OptimizedEncodingListener__bindgen_vtable

Trait Implementations§

source§

impl Debug for OptimizedEncodingListener

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl PartialEq<OptimizedEncodingListener> for OptimizedEncodingListener

source§

fn eq(&self, other: &OptimizedEncodingListener) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for OptimizedEncodingListener

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.