Struct ira::gltf::json::root::Root

source ·
pub struct Root {
Show 19 fields pub accessors: Vec<Accessor>, pub animations: Vec<Animation>, pub asset: Asset, pub buffers: Vec<Buffer>, pub buffer_views: Vec<View>, pub scene: Option<Index<Scene>>, pub extensions: Option<Root>, pub extras: Void, pub extensions_used: Vec<String>, pub extensions_required: Vec<String>, pub cameras: Vec<Camera>, pub images: Vec<Image>, pub materials: Vec<Material>, pub meshes: Vec<Mesh>, pub nodes: Vec<Node>, pub samplers: Vec<Sampler>, pub scenes: Vec<Scene>, pub skins: Vec<Skin>, pub textures: Vec<Texture>,
}
Expand description

The root object of a glTF 2.0 asset.

Fields§

§accessors: Vec<Accessor>

An array of accessors.

§animations: Vec<Animation>

An array of keyframe animations.

§asset: Asset

Metadata about the glTF asset.

§buffers: Vec<Buffer>

An array of buffers.

§buffer_views: Vec<View>

An array of buffer views.

§scene: Option<Index<Scene>>

The default scene.

§extensions: Option<Root>

Extension specific data.

§extras: Void

Optional application specific data.

§extensions_used: Vec<String>

Names of glTF extensions used somewhere in this asset.

§extensions_required: Vec<String>

Names of glTF extensions required to properly load this asset.

§cameras: Vec<Camera>

An array of cameras.

§images: Vec<Image>

An array of images.

§materials: Vec<Material>

An array of materials.

§meshes: Vec<Mesh>

An array of meshes.

§nodes: Vec<Node>

An array of nodes.

§samplers: Vec<Sampler>

An array of samplers.

§scenes: Vec<Scene>

An array of scenes.

§skins: Vec<Skin>

An array of skins.

§textures: Vec<Texture>

An array of textures.

Implementations§

source§

impl Root

source

pub fn get<T>(&self, index: Index<T>) -> Option<&T>
where Root: Get<T>,

Returns a single item from the root object.

source

pub fn push<T>(&mut self, value: T) -> Index<T>
where Root: AsMut<Vec<T>>,

Insert the given value into this (as via Vec::push()), then return the Index to it.

This allows you to easily obtain Index values with the correct index and type when creating a glTF asset.

If you have a mutable borrow conflict when using this method, consider using the more explicit Index::push() method, passing it only the necessary vector.

§Panics

Panics if there are already u32::MAX or more elements of this type, in which case an Index cannot be created.

source

pub fn from_str(str_: &str) -> Result<Root, Error>

Deserialize from a JSON string slice.

source

pub fn from_slice(slice: &[u8]) -> Result<Root, Error>

Deserialize from a JSON byte slice.

source

pub fn from_reader<R>(reader: R) -> Result<Root, Error>
where R: Read,

Deserialize from a stream of JSON.

source

pub fn to_string(&self) -> Result<String, Error>

Serialize as a String of JSON.

source

pub fn to_string_pretty(&self) -> Result<String, Error>

Serialize as a pretty-printed String of JSON.

source

pub fn to_value(&self) -> Result<Value, Error>

Serialize as a generic JSON value.

source

pub fn to_vec(&self) -> Result<Vec<u8>, Error>

Serialize as a JSON byte vector.

source

pub fn to_vec_pretty(&self) -> Result<Vec<u8>, Error>

Serialize as a pretty-printed JSON byte vector.

source

pub fn to_writer<W>(&self, writer: W) -> Result<(), Error>
where W: Write,

Serialize as a JSON byte writertor.

source

pub fn to_writer_pretty<W>(&self, writer: W) -> Result<(), Error>
where W: Write,

Serialize as a pretty-printed JSON byte writertor.

Trait Implementations§

source§

impl AsMut<Vec<Accessor>> for Root

source§

fn as_mut(&mut self) -> &mut Vec<Accessor>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<Vec<Animation>> for Root

source§

fn as_mut(&mut self) -> &mut Vec<Animation>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<Vec<Buffer>> for Root

source§

fn as_mut(&mut self) -> &mut Vec<Buffer>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<Vec<Camera>> for Root

source§

fn as_mut(&mut self) -> &mut Vec<Camera>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<Vec<Image>> for Root

source§

fn as_mut(&mut self) -> &mut Vec<Image>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<Vec<Material>> for Root

source§

fn as_mut(&mut self) -> &mut Vec<Material>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<Vec<Mesh>> for Root

source§

fn as_mut(&mut self) -> &mut Vec<Mesh>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<Vec<Node>> for Root

source§

fn as_mut(&mut self) -> &mut Vec<Node>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<Vec<Sampler>> for Root

source§

fn as_mut(&mut self) -> &mut Vec<Sampler>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<Vec<Scene>> for Root

source§

fn as_mut(&mut self) -> &mut Vec<Scene>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<Vec<Skin>> for Root

source§

fn as_mut(&mut self) -> &mut Vec<Skin>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<Vec<Texture>> for Root

source§

fn as_mut(&mut self) -> &mut Vec<Texture>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<Vec<View>> for Root

source§

fn as_mut(&mut self) -> &mut Vec<View>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<[Accessor]> for Root

source§

fn as_ref(&self) -> &[Accessor]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<[Animation]> for Root

source§

fn as_ref(&self) -> &[Animation]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<[Buffer]> for Root

source§

fn as_ref(&self) -> &[Buffer]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<[Camera]> for Root

source§

fn as_ref(&self) -> &[Camera]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<[Image]> for Root

source§

fn as_ref(&self) -> &[Image]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<[Material]> for Root

source§

fn as_ref(&self) -> &[Material]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<[Mesh]> for Root

source§

fn as_ref(&self) -> &[Mesh]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<[Node]> for Root

source§

fn as_ref(&self) -> &[Node]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<[Sampler]> for Root

source§

fn as_ref(&self) -> &[Sampler]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<[Scene]> for Root

source§

fn as_ref(&self) -> &[Scene]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<[Skin]> for Root

source§

fn as_ref(&self) -> &[Skin]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<[Texture]> for Root

source§

fn as_ref(&self) -> &[Texture]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<[View]> for Root

source§

fn as_ref(&self) -> &[View]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for Root

source§

fn clone(&self) -> Root

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Root

source§

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

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

impl Default for Root

source§

fn default() -> Root

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Root

source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Root, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<'a> Get<Accessor> for Root

source§

fn get(&self, index: Index<Accessor>) -> Option<&Accessor>

Retrieves a single value at the given index.
source§

impl<'a> Get<Animation> for Root

source§

fn get(&self, index: Index<Animation>) -> Option<&Animation>

Retrieves a single value at the given index.
source§

impl<'a> Get<Buffer> for Root

source§

fn get(&self, index: Index<Buffer>) -> Option<&Buffer>

Retrieves a single value at the given index.
source§

impl<'a> Get<Camera> for Root

source§

fn get(&self, index: Index<Camera>) -> Option<&Camera>

Retrieves a single value at the given index.
source§

impl<'a> Get<Image> for Root

source§

fn get(&self, index: Index<Image>) -> Option<&Image>

Retrieves a single value at the given index.
source§

impl<'a> Get<Material> for Root

source§

fn get(&self, index: Index<Material>) -> Option<&Material>

Retrieves a single value at the given index.
source§

impl<'a> Get<Mesh> for Root

source§

fn get(&self, index: Index<Mesh>) -> Option<&Mesh>

Retrieves a single value at the given index.
source§

impl<'a> Get<Node> for Root

source§

fn get(&self, index: Index<Node>) -> Option<&Node>

Retrieves a single value at the given index.
source§

impl<'a> Get<Sampler> for Root

source§

fn get(&self, index: Index<Sampler>) -> Option<&Sampler>

Retrieves a single value at the given index.
source§

impl<'a> Get<Scene> for Root

source§

fn get(&self, index: Index<Scene>) -> Option<&Scene>

Retrieves a single value at the given index.
source§

impl<'a> Get<Skin> for Root

source§

fn get(&self, index: Index<Skin>) -> Option<&Skin>

Retrieves a single value at the given index.
source§

impl<'a> Get<Texture> for Root

source§

fn get(&self, index: Index<Texture>) -> Option<&Texture>

Retrieves a single value at the given index.
source§

impl<'a> Get<View> for Root

source§

fn get(&self, index: Index<View>) -> Option<&View>

Retrieves a single value at the given index.
source§

impl Serialize for Root

source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Validate for Root

source§

fn validate<P, R>(&self, _root: &Root, _path: P, _report: &mut R)
where P: Fn() -> Path, R: FnMut(&dyn Fn() -> Path, Error),

Validates the invariants required for the library to function safely.

Auto Trait Implementations§

§

impl Freeze for Root

§

impl RefUnwindSafe for Root

§

impl Send for Root

§

impl Sync for Root

§

impl Unpin for Root

§

impl UnwindSafe for Root

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,