Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 17 variants Io { path: PathBuf, source: Error, }, Json { path: Option<PathBuf>, source: Error, }, Image { path: PathBuf, reason: String, }, Rgbe { reason: String, }, Ktx2 { reason: String, }, Lut { loader: &'static str, reason: String, }, UnsupportedFormat { what: &'static str, value: String, }, UnsupportedTextureType { what: &'static str, texture_type: TextureType, }, Gltf(GltfError), NoKeyframes { track: String, }, UnsupportedTrackType { name: String, }, UnsupportedInterpolation { value_type: &'static str, track: String, }, TrackName(ParseTrackNameError), NoAdapter { wanted: Option<String>, }, Device(RequestDeviceError), Readback { reason: String, }, Unsupported { field: &'static str, kind: MaterialKind, },
}
Expand description

Everything the public API of three-rs can fail with.

Non-exhaustive: new variants are added as more of the port’s surface stops panicking, and matching code should carry a _ arm.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Io

A file a loader was pointed at could not be read.

Fields

§path: PathBuf

The file that could not be read.

§source: Error

What the OS said.

§

Json

A JSON document could not be parsed. path is None when the caller handed the JSON over directly, as BufferGeometryLoader::parse does.

Fields

§path: Option<PathBuf>

The file the JSON was read from, when there was one.

§source: Error

What serde_json said.

§

Image

An image file the decoder rejected.

Fields

§path: PathBuf

The image file.

§reason: String

Why the decoder rejected it.

§

Rgbe

A Radiance RGBE (.hdr) file the decoder rejected. reason is three.js’ own rgbe_error() message, less its THREE.HDRLoader: prefix.

Fields

§reason: String

The decoder’s message.

§

Ktx2

A KTX 2.0 file KTX2Loader rejected, or one it cannot transcode for this device. reason is three.js’ own message, less its THREE.KTX2Loader: prefix.

Fields

§reason: String

The decoder’s message.

§

Lut

A colour lookup table LUTCubeLoader, LUT3dlLoader or LUTImageLoader rejected. loader is the three.js class name and reason its own message, less the THREE.<loader>: prefix.

Fields

§loader: &'static str

The three.js loader class, e.g. "LUTCubeLoader".

§reason: String

The loader’s message.

§

UnsupportedFormat

A file names a type, format or encoding this port does not implement. what says which field it was read from.

Fields

§what: &'static str

The field the value was read from.

§value: String

The unsupported value.

§

UnsupportedTextureType

A texture type that is not a legal depth format (gpu_format) or not a legal colour format (color_gpu_format).

Fields

§what: &'static str

Which check failed (gpu_format or color_gpu_format).

§texture_type: TextureType

The texture type that failed it.

§

Gltf(GltfError)

A glTF asset the loader could not make sense of.

§

NoKeyframes

new KeyframeTrack() with an empty times array.

Fields

§track: String

The track’s name.

§

UnsupportedTrackType

A track type name that no KeyframeTrack subclass answers to.

Fields

§name: String

The type name that was not recognized.

§

UnsupportedInterpolation

An interpolation mode this track’s value type does not support, where the value type’s own default does not support it either.

Fields

§value_type: &'static str

The track’s value type ("vector", "quaternion", …).

§track: String

The track’s name.

§

TrackName(ParseTrackNameError)

A track name PropertyBinding cannot parse.

§

NoAdapter

No adapter to render on — no Vulkan device natively, or navigator.gpu.requestAdapter() resolving to null in a browser. wanted is the THREE_RS_ADAPTER_NAME filter, when one was set and matched nothing; it is always None on wasm32, where the browser picks the adapter and there is nothing to filter.

Fields

§wanted: Option<String>

The THREE_RS_ADAPTER_NAME filter that matched nothing, if one was set.

§

Device(RequestDeviceError)

adapter.request_device() failed.

§

Readback

Reading pixels back off the GPU failed; reason is what wgpu said.

Fields

§reason: String

What wgpu said.

§

Unsupported

A material field that is set but that no part of the port reads for this kind of material — see MeshBasicNodeMaterial::check_supported and the audit in docs/api.md. field is the three.js name.

Fields

§field: &'static str

The three.js field name.

§kind: MaterialKind

The material kind it was set on.

Trait Implementations§

Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<GltfError> for Error

Source§

fn from(error: GltfError) -> Self

Converts to this type from the input type.
Source§

impl From<ParseTrackNameError> for Error

Source§

fn from(error: ParseTrackNameError) -> Self

Converts to this type from the input type.
Source§

impl From<RequestDeviceError> for Error

Source§

fn from(error: RequestDeviceError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,