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>
) -> Root<Dom<ReadableStream>>
pub fn new_from_bytes(
global: &GlobalScope,
bytes: Vec<u8>
) -> 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>)
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>) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::ReadableStreamBinding::ReadableStreamBinding::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>) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::readablestream::ReadableStream>>}
const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::ReadableStreamBinding::ReadableStreamBinding::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>) -> 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 JSTraceable for ReadableStream
impl JSTraceable 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§unsafe fn init_reflector(&self, obj: *mut JSObject)
unsafe fn init_reflector(&self, obj: *mut JSObject)
Initializes the Reflector
source§impl PartialEq<ReadableStream> for ReadableStream
impl PartialEq<ReadableStream> for ReadableStream
source§fn eq(&self, other: &ReadableStream) -> bool
fn eq(&self, other: &ReadableStream) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl ToJSValConvertible for ReadableStream
impl ToJSValConvertible for ReadableStream
Auto Trait Implementations§
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> 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> MaybeBoxed<Box<T, Global>> for T
impl<T> MaybeBoxed<Box<T, Global>> for T
source§fn maybe_boxed(self) -> Box<T, Global>
fn maybe_boxed(self) -> Box<T, Global>
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