Root

Struct Root 

Source
pub struct Root {
Show 18 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 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.

§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 Self: Get<T>,

Returns a single item from the root object.

Source

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

Deserialize from a JSON byte slice.

Source

pub fn from_reader<R>(reader: R) -> Result<Self, 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.

Source§

impl Root

Source

pub fn add_accessor(&mut self, data: Accessor) -> Index<Accessor>

Source§

impl Root

Source

pub fn add_buffer(&mut self, data: Buffer) -> Index<Buffer>

Source§

impl Root

Source

pub fn add_buffer_view(&mut self, data: View) -> Index<View>

Source§

impl Root

Source

pub fn add_node(&mut self, data: Node) -> Index<Node>

Source§

impl Root

Source

pub fn add_mesh(&mut self, data: Mesh) -> Index<Mesh>

Source§

impl Root

Source

pub fn add_scene(&mut self, data: Scene) -> Index<Scene>

Trait Implementations§

Source§

impl Clone for Root

Source§

fn clone(&self) -> Root

Returns a duplicate 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

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<Self, __D::Error>
where __D: Deserializer<'de>,

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

impl FromStr for Root

Source§

fn from_str(str_: &str) -> Result<Self, Self::Err>

Deserialize from a JSON string slice.

Source§

type Err = Error

The associated error which can be returned from parsing.
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<'a> GetMut<Accessor> for Root

Source§

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

Retrieves a single value at the given index.
Source§

impl<'a> GetMut<Animation> for Root

Source§

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

Retrieves a single value at the given index.
Source§

impl<'a> GetMut<Buffer> for Root

Source§

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

Retrieves a single value at the given index.
Source§

impl<'a> GetMut<Camera> for Root

Source§

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

Retrieves a single value at the given index.
Source§

impl<'a> GetMut<Image> for Root

Source§

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

Retrieves a single value at the given index.
Source§

impl<'a> GetMut<Material> for Root

Source§

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

Retrieves a single value at the given index.
Source§

impl<'a> GetMut<Mesh> for Root

Source§

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

Retrieves a single value at the given index.
Source§

impl<'a> GetMut<Node> for Root

Source§

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

Retrieves a single value at the given index.
Source§

impl<'a> GetMut<Sampler> for Root

Source§

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

Retrieves a single value at the given index.
Source§

impl<'a> GetMut<Scene> for Root

Source§

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

Retrieves a single value at the given index.
Source§

impl<'a> GetMut<Skin> for Root

Source§

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

Retrieves a single value at the given index.
Source§

impl<'a> GetMut<Texture> for Root

Source§

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

Retrieves a single value at the given index.
Source§

impl<'a> GetMut<View> for Root

Source§

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

Retrieves a single value at the given index.
Source§

impl Serialize for Root

Source§

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

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

impl Validate for Root

Source§

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

Validates only the invariants required for the library to function safely.
Source§

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

Validates the data against the glTF 2.0 specification. Read more

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§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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

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

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