Skip to main content

LoadError

Enum LoadError 

Source
#[non_exhaustive]
pub enum LoadError { Io { path: String, source: Error, }, ExternalResource(ExternalResourceFailure), Gltf(Error), SourceFacts(SourceFactsError), Buffer(String), Malformed(String), Topology(String), PrimitiveEncoding { mesh: usize, primitive: usize, attribute: String, accessor: usize, found: String, expected: String, }, PrimitiveAccessorLayout { mesh: usize, primitive: usize, attribute: String, accessor: usize, problem: String, }, AnimationAccessorLayout { clip: String, node: usize, slot: &'static str, accessor: usize, problem: String, }, AnimationEncoding { animation: usize, sampler: usize, slot: &'static str, node: usize, property: &'static str, accessor: usize, found: String, expected: String, }, }
Expand description

Errors returned while loading .gltf or .glb input.

These are structural or operator errors. Semantic animation defects, such as non-unit quaternions or seam pops, load successfully and are reported by animsmith-core checks.

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

The source file or one of its external buffers could not be read.

Fields

§path: String

Path that failed to read.

§source: Error

Underlying filesystem error.

§

ExternalResource(ExternalResourceFailure)

A rooted external dependency required to construct the document failed.

§

Gltf(Error)

The gltf parser rejected the container.

§

SourceFacts(SourceFactsError)

The format-neutral source-facts projection contradicted a core invariant.

§

Buffer(String)

Buffer resolution or GLB framing failed.

§

Malformed(String)

Animation data is structurally malformed.

§

Topology(String)

The node graph is not a forest that can become a skeleton.

§

PrimitiveEncoding

A primitive’s vertex-attribute or index accessor declares an element encoding the loader cannot read as authored. Either the file contradicts the glTF vertex-attribute rules (a VEC3 TEXCOORD_0, or an integer TEXCOORD_0/WEIGHTS_0 without normalized: true), or it uses a spec-permitted encoding the gltf crate’s reader has no decoder for (a KHR_mesh_quantization POSITION). The message reports the encodings that slot accepts.

Fields

§mesh: usize

glTF index of the mesh holding the primitive.

§primitive: usize

Index of the primitive within that mesh.

§attribute: String

Attribute semantic or slot name, such as TEXCOORD_0.

§accessor: usize

Index of the offending accessor.

§found: String

Declared encoding, such as VEC3 of FLOAT.

§expected: String

Encodings the reader accepts, such as VEC2 of normalized UNSIGNED_BYTE, normalized UNSIGNED_SHORT, or FLOAT.

§

PrimitiveAccessorLayout

A primitive’s vertex-attribute or index accessor declares an element the loader does read, but addresses its bytes in a way the reader cannot walk: a buffer view whose own extent overflows, exceeds its buffer declaration, or exceeds the bytes that actually resolved; a byteStride shorter than the element it strides over; a sparse block of count 0; or a count/byteOffset whose required extent overflows or exceeds its buffer view. gltf’s Validate relates an accessor to none of these. The first shapes can panic in the reader; a merely short extent instead makes the reader return None, which is equally unsafe to substitute with empty geometry.

Fields

§mesh: usize

glTF index of the mesh holding the primitive.

§primitive: usize

Index of the primitive within that mesh.

§attribute: String

Attribute semantic or slot name, such as TEXCOORD_0.

§accessor: usize

Index of the offending accessor.

§problem: String

What the reader could not walk, such as reads its elements from buffer view 0 at byteStride 4, shorter than the 12-byte element it strides over.

§

AnimationAccessorLayout

An animation sampler’s input or output accessor addresses its bytes in a way the reader cannot walk — the same layout shapes Self::PrimitiveAccessorLayout names, reached through read_inputs/read_outputs instead of through a primitive.

This is the sampler’s layout, not its encoding: an accessor typed for a different element than the sampler’s reader decodes is a separate class and is not judged here.

Fields

§clip: String

Name the clip loads under, as reported by every other animation diagnostic.

§node: usize

glTF index of the node the offending channel targets.

§slot: &'static str

Sampler slot the accessor fills: input or output.

§accessor: usize

Index of the offending accessor.

§problem: String

What the reader could not walk, such as reads its sparse indices from buffer view 2, whose byteOffset 18446744073709551615 plus byteLength 12 is a byte extent that overflows.

§

AnimationEncoding

An animation sampler’s input or output accessor declares an element encoding the property-specific reader cannot decode. The reader always expects scalar FLOAT key times; outputs are VEC3 of FLOAT for translation/scale, or one of glTF’s five component encodings as VEC4 rotation and scalar morph weights.

Fields

§animation: usize

glTF index of the animation holding the sampler.

§sampler: usize

Index of the sampler within that animation.

§slot: &'static str

Sampler slot the accessor fills: input or output.

§node: usize

glTF index of the node the channel targets.

§property: &'static str

Target property selecting the output reader.

§accessor: usize

Index of the offending accessor.

§found: String

Declared encoding, such as VEC3 of FLOAT.

§expected: String

Encodings the selected reader accepts.

Trait Implementations§

Source§

impl Debug for LoadError

Source§

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

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

impl Display for LoadError

Source§

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

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

impl Error for LoadError

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<Error> for LoadError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<LoadError> for GltfScalePreflightError

Source§

fn from(source: LoadError) -> Self

Converts to this type from the input type.
Source§

impl From<LoadError> for GltfScaleRewriteError

Source§

fn from(source: LoadError) -> Self

Converts to this type from the input type.
Source§

impl From<LoadError> for FixError

Source§

fn from(source: LoadError) -> Self

Converts to this type from the input type.
Source§

impl From<SourceFactsError> for LoadError

Source§

fn from(source: SourceFactsError) -> 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<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> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.