pub struct VertexLayout { /* private fields */ }Expand description
Describes the memory layout of a single interleaved vertex record.
Attributes are stored in insertion order; the stride is computed automatically from the sum of all attribute sizes.
Implementations§
Source§impl VertexLayout
impl VertexLayout
Sourcepub fn add(
&mut self,
name: impl Into<String>,
attribute: VertexAttribute,
) -> &mut Self
pub fn add( &mut self, name: impl Into<String>, attribute: VertexAttribute, ) -> &mut Self
Append a named attribute to the layout.
Returns &mut self for builder-style chaining.
Sourcepub fn stride(&self) -> usize
pub fn stride(&self) -> usize
Total byte size of one vertex record (sum of all attribute sizes).
Sourcepub fn attribute_count(&self) -> usize
pub fn attribute_count(&self) -> usize
Number of attributes in the layout.
Sourcepub fn slots(&self) -> &[VertexSlot]
pub fn slots(&self) -> &[VertexSlot]
Iterate over the slots in declaration order.
Sourcepub fn slot_by_name(&self, name: &str) -> Option<&VertexSlot>
pub fn slot_by_name(&self, name: &str) -> Option<&VertexSlot>
Return the slot with name, if present.
Trait Implementations§
Source§impl Clone for VertexLayout
impl Clone for VertexLayout
Source§fn clone(&self) -> VertexLayout
fn clone(&self) -> VertexLayout
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VertexLayout
impl Debug for VertexLayout
Source§impl Default for VertexLayout
impl Default for VertexLayout
Source§fn default() -> VertexLayout
fn default() -> VertexLayout
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for VertexLayout
impl RefUnwindSafe for VertexLayout
impl Send for VertexLayout
impl Sync for VertexLayout
impl Unpin for VertexLayout
impl UnsafeUnpin for VertexLayout
impl UnwindSafe for VertexLayout
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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