pub struct Index<T>(/* private fields */);
Expand description
Represents an offset into a vector of type T
owned by the root glTF object.
This type may be used with the following functions:
Root::get()
to retrieve objects fromRoot
.Root::push()
to add new objects toRoot
.
Implementations§
source§impl<T> Index<T>
impl<T> Index<T>
sourcepub fn push(vec: &mut Vec<T>, value: T) -> Index<T>
pub fn push(vec: &mut Vec<T>, value: T) -> Index<T>
Given a vector of glTF objects, call Vec::push()
to insert it into the vector,
then return an Index
for it.
This allows you to easily obtain Index
values with the correct index and type when
creating a glTF asset. Note that for Root
, you can call Root::push()
without
needing to retrieve the correct vector first.
§Panics
Panics if the vector has u32::MAX
or more elements, in which case an Index
cannot be
created.
Trait Implementations§
source§impl<'de, T> Deserialize<'de> for Index<T>
impl<'de, T> Deserialize<'de> for Index<T>
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
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<T> Ord for Index<T>
impl<T> Ord for Index<T>
source§impl<T> PartialEq for Index<T>
impl<T> PartialEq for Index<T>
source§impl<T> PartialOrd for Index<T>
impl<T> PartialOrd for Index<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<T> Copy for Index<T>
impl<T> Eq for Index<T>
Auto Trait Implementations§
impl<T> Freeze for Index<T>
impl<T> RefUnwindSafe for Index<T>
impl<T> Send for Index<T>
impl<T> Sync for Index<T>
impl<T> Unpin for Index<T>
impl<T> UnwindSafe for Index<T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more