Skip to main content

GltfError

Enum GltfError 

Source
#[non_exhaustive]
pub enum GltfError {
Show 17 variants NotUtf8, UnsupportedVersion(String), BadHeader, LegacyBinary, TruncatedChunk, NoJsonChunk, NoBinChunk, MissingField { what: &'static str, }, MissingIndex { kind: &'static str, index: usize, }, UnsupportedComponentType(i64), UnsupportedAccessorType(String), BadDataUri(String), BadBase64(char), UnsupportedRequiredExtension(String), Draco { mesh: usize, primitive: usize, reason: String, }, BufferViewOutOfRange { index: usize, }, Meshopt { buffer_view: usize, reason: String, },
}
Expand description

What went wrong inside a glTF asset, as far as the loader reads it.

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.
§

NotUtf8

A JSON chunk, or a .gltf file, that is not UTF-8.

§

UnsupportedVersion(String)

asset.version is not 2.x.

§

BadHeader

The 12-byte GLB header has the wrong magic.

§

LegacyBinary

A GLB written against the draft container format.

§

TruncatedChunk

A GLB chunk that runs past the end of the file.

§

NoJsonChunk

A GLB with no JSON chunk.

§

NoBinChunk

A buffer with no uri in a GLB that has no BIN chunk.

§

MissingField

A field a definition cannot be read without (accessor.type, sampler.input, …). what names it.

Fields

§what: &'static str

The missing field’s name.

§

MissingIndex

An index into one of the asset’s arrays that is not there. kind is the array (accessor, bufferView, buffer, mesh).

Fields

§kind: &'static str

The array the index was into.

§index: usize

The index that was not there.

§

UnsupportedComponentType(i64)

An accessor componentType the port does not read.

§

UnsupportedAccessorType(String)

An accessor type the port does not read.

§

BadDataUri(String)

A data: URI that is not data:<mime>;base64,<payload>.

§

BadBase64(char)

A character that is not in the base64 alphabet.

§

UnsupportedRequiredExtension(String)

An extension in extensionsRequired that the port does not read. three.js only warns here ('Unknown extension') and then decodes nothing, which on this stack is a silent wrong picture, so the port refuses the asset instead.

§

Draco

A KHR_draco_mesh_compression primitive that does not decode. mesh and primitive locate it; reason is the decoder’s, or what DRACOLoader would have thrown on.

Fields

§mesh: usize

The mesh index.

§primitive: usize

The primitive index within mesh.

§reason: String

The decoder’s message.

§

BufferViewOutOfRange

A bufferView whose byte range runs past the end of its buffer.

Fields

§index: usize

The bufferView’s index.

§

Meshopt

An EXT_meshopt_compression bufferView that does not decode. reason is the decoder’s, or the extension rule it breaks.

Fields

§buffer_view: usize

The bufferView’s index.

§reason: String

The decoder’s message, or the extension rule that was broken.

Trait Implementations§

Source§

impl Debug for GltfError

Source§

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

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

impl Display for GltfError

Source§

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

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

impl Error for GltfError

1.30.0 · 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.

Auto Trait Implementations§

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,