pub enum WebGlInitError {
CanvasNotFound(String),
CanvasQuery(JsValue),
ContextUnavailable,
ContextLookup(JsValue),
ContextCast,
}Expand description
Errors that can occur while initializing a WebGlRenderer.
WebGL context acquisition is synchronous, so the failure modes are far
fewer than WebGpuInitError: the canvas must resolve and the browser
must hand back a WebGl2RenderingContext. Each variant maps to one
specific failure mode; the caller decides how to surface it (typically
via Console::error on the example side).
Variants§
CanvasNotFound(String)
document.querySelector(canvas_selector) returned None.
The canvas element is not in the DOM yet (or its selector is wrong). Carries the selector string that was queried.
CanvasQuery(JsValue)
document.querySelector(canvas_selector) threw an exception.
canvas.get_context("webgl2") returned None.
The browser does not support WebGL 2, or the canvas is already bound to a different context type.
ContextLookup(JsValue)
canvas.get_context("webgl2") threw an exception.
ContextCast
The object returned by canvas.get_context("webgl2") could not be
cast to WebGl2RenderingContext.
Implementations§
Source§impl WebGlInitError
Implements WebGlInitError diagnostic helpers.
impl WebGlInitError
Implements WebGlInitError diagnostic helpers.
Trait Implementations§
Source§impl Clone for WebGlInitError
impl Clone for WebGlInitError
Source§fn clone(&self) -> WebGlInitError
fn clone(&self) -> WebGlInitError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WebGlInitError
impl Debug for WebGlInitError
Source§impl Display for WebGlInitError
Implements std::fmt::Display for WebGlInitError.
impl Display for WebGlInitError
Implements std::fmt::Display for WebGlInitError.
The formatted message includes the variant code plus a human-readable description; variants carrying a JS error append its rendered form.
Source§impl Error for WebGlInitError
Implements the standard std::error::Error trait for WebGlInitError.
impl Error for WebGlInitError
Implements the standard std::error::Error trait for WebGlInitError.
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()