use super::*;
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct GPUPipelineError {
inner: DOMException,
}
impl FromVal for GPUPipelineError {
fn from_val(v: &Any) -> Self {
GPUPipelineError {
inner: DOMException::from_val(v),
}
}
fn take_ownership(v: AnyHandle) -> Self {
Self::from_val(&Any::take_ownership(v))
}
fn as_handle(&self) -> AnyHandle {
self.inner.as_handle()
}
}
impl core::ops::Deref for GPUPipelineError {
type Target = DOMException;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl core::ops::DerefMut for GPUPipelineError {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl AsRef<Any> for GPUPipelineError {
fn as_ref(&self) -> &Any {
&self.inner
}
}
impl AsMut<Any> for GPUPipelineError {
fn as_mut(&mut self) -> &mut Any {
&mut self.inner
}
}
impl From<GPUPipelineError> for Any {
fn from(s: GPUPipelineError) -> Any {
let handle = s.inner.as_handle();
core::mem::forget(s);
Any::take_ownership(handle)
}
}
impl From<&GPUPipelineError> for Any {
fn from(s: &GPUPipelineError) -> Any {
s.inner.clone().into()
}
}
jsbind::utils::impl_dyn_cast!(GPUPipelineError);
impl GPUPipelineError {
pub fn reason(&self) -> GPUPipelineErrorReason {
self.inner.get("reason").as_::<GPUPipelineErrorReason>()
}
}
impl GPUPipelineError {
pub fn new() -> GPUPipelineError {
Self {
inner: Any::global("GPUPipelineError")
.new(&[])
.as_::<DOMException>(),
}
}
}
impl GPUPipelineError {
pub fn new_with_message(message: &JsString) -> GPUPipelineError {
Self {
inner: Any::global("GPUPipelineError")
.new(&[message.into()])
.as_::<DOMException>(),
}
}
}
impl GPUPipelineError {
pub fn new_with_message_and_options(
message: &JsString,
options: &GPUPipelineErrorInit,
) -> GPUPipelineError {
Self {
inner: Any::global("GPUPipelineError")
.new(&[message.into(), options.into()])
.as_::<DOMException>(),
}
}
}