Struct script::dom::readablestream::ReadableStream
source · #[repr(C)]pub struct ReadableStream {
reflector_: Reflector,
js_stream: Heap<*mut JSObject>,
js_reader: Heap<*mut JSObject>,
has_reader: Cell<bool>,
external_underlying_source: Option<Rc<ExternalUnderlyingSourceController>>,
}
Fields§
§reflector_: Reflector
§js_stream: Heap<*mut JSObject>
§js_reader: Heap<*mut JSObject>
§has_reader: Cell<bool>
§external_underlying_source: Option<Rc<ExternalUnderlyingSourceController>>
Implementations§
source§impl ReadableStream
impl ReadableStream
fn __assert_parent_type(&self)
source§impl ReadableStream
impl ReadableStream
fn new_inherited( external_underlying_source: Option<Rc<ExternalUnderlyingSourceController>>, ) -> ReadableStream
fn new( global: &GlobalScope, external_underlying_source: Option<Rc<ExternalUnderlyingSourceController>>, ) -> Root<Dom<ReadableStream>>
sourcepub unsafe fn from_js(
cx: SafeJSContext,
obj: *mut JSObject,
realm: InRealm<'_>,
) -> Result<Root<Dom<ReadableStream>>, ()>
pub unsafe fn from_js( cx: SafeJSContext, obj: *mut JSObject, realm: InRealm<'_>, ) -> Result<Root<Dom<ReadableStream>>, ()>
Used from RustCodegen.py
sourcepub fn new_from_bytes(
global: &GlobalScope,
bytes: Vec<u8>,
can_gc: CanGc,
) -> Root<Dom<ReadableStream>>
pub fn new_from_bytes( global: &GlobalScope, bytes: Vec<u8>, can_gc: CanGc, ) -> Root<Dom<ReadableStream>>
Build a stream backed by a Rust source that has already been read into memory.
sourcepub fn new_with_external_underlying_source(
global: &GlobalScope,
source: ExternalUnderlyingSource,
) -> Root<Dom<ReadableStream>>
pub fn new_with_external_underlying_source( global: &GlobalScope, source: ExternalUnderlyingSource, ) -> Root<Dom<ReadableStream>>
Build a stream backed by a Rust underlying source.
sourcepub fn get_js_stream(&self) -> NonNull<JSObject>
pub fn get_js_stream(&self) -> NonNull<JSObject>
Get a pointer to the underlying JS object.
pub fn enqueue_native(&self, bytes: Vec<u8>, can_gc: CanGc)
pub fn error_native(&self, error: Error)
pub fn close_native(&self)
sourcepub fn get_in_memory_bytes(&self) -> Option<Vec<u8>>
pub fn get_in_memory_bytes(&self) -> Option<Vec<u8>>
Return bytes for synchronous use, if the stream has all data in memory.
sourcepub fn start_reading(&self) -> Result<(), ()>
pub fn start_reading(&self) -> Result<(), ()>
Acquires a reader and locks the stream,
must be done before read_a_chunk
.
sourcepub fn read_a_chunk(&self) -> Rc<Promise>
pub fn read_a_chunk(&self) -> Rc<Promise>
Read a chunk from the stream,
must be called after start_reading
,
and before stop_reading
.
sourcepub fn stop_reading(&self)
pub fn stop_reading(&self)
Releases the lock on the reader,
must be done after start_reading
.
pub fn is_locked(&self) -> bool
pub fn is_disturbed(&self) -> bool
Trait Implementations§
source§impl DomObject for ReadableStream
impl DomObject for ReadableStream
source§impl DomObjectWrap for ReadableStream
impl DomObjectWrap for ReadableStream
source§const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>, _: CanGc) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::ReadableStreamBinding::ReadableStream_Binding::Wrap as for<'a, 'b> unsafe fn(script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::readablestream::ReadableStream>, script_runtime::CanGc) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::readablestream::ReadableStream>>}
const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>, _: CanGc) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::ReadableStreamBinding::ReadableStream_Binding::Wrap as for<'a, 'b> unsafe fn(script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::readablestream::ReadableStream>, script_runtime::CanGc) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::readablestream::ReadableStream>>}
Function pointer to the general wrap function type
source§impl HasParent for ReadableStream
impl HasParent for ReadableStream
source§impl IDLInterface for ReadableStream
impl IDLInterface for ReadableStream
source§impl MallocSizeOf for ReadableStream
impl MallocSizeOf for ReadableStream
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
source§impl MutDomObject for ReadableStream
impl MutDomObject for ReadableStream
source§impl PartialEq for ReadableStream
impl PartialEq for ReadableStream
source§impl ToJSValConvertible for ReadableStream
impl ToJSValConvertible for ReadableStream
source§impl Traceable for ReadableStream
impl Traceable for ReadableStream
impl Eq for ReadableStream
Auto Trait Implementations§
impl !Freeze for ReadableStream
impl !RefUnwindSafe for ReadableStream
impl !Send for ReadableStream
impl !Sync for ReadableStream
impl Unpin for ReadableStream
impl !UnwindSafe for ReadableStream
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert