use dom_struct::dom_struct;
use js::rust::HandleValue as SafeHandleValue;
use crate::dom::bindings::codegen::Bindings::ReadableByteStreamControllerBinding::ReadableByteStreamControllerMethods;
use crate::dom::bindings::import::module::{Error, Fallible};
use crate::dom::bindings::reflector::Reflector;
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
use crate::dom::readablestream::ReadableStream;
use crate::script_runtime::JSContext as SafeJSContext;
#[dom_struct]
pub struct ReadableByteStreamController {
reflector_: Reflector,
stream: MutNullableDom<ReadableStream>,
}
impl ReadableByteStreamController {
pub fn set_stream(&self, stream: &ReadableStream) {
self.stream.set(Some(stream))
}
}
impl ReadableByteStreamControllerMethods<crate::DomTypeHolder> for ReadableByteStreamController {
fn GetByobRequest(
&self,
) -> Fallible<Option<DomRoot<super::readablestreambyobrequest::ReadableStreamBYOBRequest>>>
{
Err(Error::NotFound)
}
fn GetDesiredSize(&self) -> Option<f64> {
None
}
fn Close(&self) -> Fallible<()> {
Err(Error::NotFound)
}
fn Enqueue(
&self,
_chunk: js::gc::CustomAutoRooterGuard<js::typedarray::ArrayBufferView>,
) -> Fallible<()> {
Err(Error::NotFound)
}
fn Error(&self, _cx: SafeJSContext, _e: SafeHandleValue) -> Fallible<()> {
Err(Error::NotFound)
}
}