pub struct StreamChannels {
channels: ArrayVec<(u32, ChannelEncoding), { StreamChannels::CAPACITY }>,
}Expand description
The channels one per-vertex stream carries, in the order they are interleaved.
Each channel is an attribute location paired with its encoding, and the attributes of a wgpu vertex-buffer layout are laid out in exactly this order: sequential offsets from the channel sizes, stride the sum of them.
Fields§
§channels: ArrayVec<(u32, ChannelEncoding), { StreamChannels::CAPACITY }>The channels, in attribute order.
Implementations§
Source§impl StreamChannels
impl StreamChannels
Sourcepub fn new(channels: impl IntoIterator<Item = (u32, ChannelEncoding)>) -> Self
pub fn new(channels: impl IntoIterator<Item = (u32, ChannelEncoding)>) -> Self
A stream carrying channels, in attribute order.
§Panics
If there are more than Self::CAPACITY of them.
Sourcepub fn push(&mut self, channel: (u32, ChannelEncoding))
pub fn push(&mut self, channel: (u32, ChannelEncoding))
Append one channel after the channels already declared.
§Panics
If the stream already holds Self::CAPACITY channels.
Sourcepub fn iter(&self) -> impl Iterator<Item = &(u32, ChannelEncoding)>
pub fn iter(&self) -> impl Iterator<Item = &(u32, ChannelEncoding)>
The channels in attribute order.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether no channel is declared, in which case the slot must be left out of a pipeline’s vertex-buffer list.
Sourcepub fn byte_len(&self, vertex_count: usize) -> usize
pub fn byte_len(&self, vertex_count: usize) -> usize
Bytes a vertex_count-long stream occupies.
Sourcepub fn attribute_offsets(
&self,
) -> impl Iterator<Item = (u32, ChannelEncoding, u64)> + '_
pub fn attribute_offsets( &self, ) -> impl Iterator<Item = (u32, ChannelEncoding, u64)> + '_
The offset each channel’s attribute sits at, in attribute order.
These are the offsets a wgpu vertex-buffer layout declares; a packed stream writes its channels at the same offsets.
Sourcepub fn layout(&self) -> VertexBufferLayoutDesc
pub fn layout(&self) -> VertexBufferLayoutDesc
The wgpu vertex-buffer layout these channels describe.
The attributes are declared in channel order with the offsets
Self::attribute_offsets reports and the stride Self::stride
reports, so the layout a pipeline declares and the bytes
PositionStreamWriter/SecondaryStreamWriter pack always agree.
Trait Implementations§
Source§impl Clone for StreamChannels
impl Clone for StreamChannels
Source§impl Debug for StreamChannels
impl Debug for StreamChannels
Source§impl Default for StreamChannels
impl Default for StreamChannels
impl Eq for StreamChannels
Source§impl Hash for StreamChannels
impl Hash for StreamChannels
Source§impl PartialEq for StreamChannels
impl PartialEq for StreamChannels
impl StructuralPartialEq for StreamChannels
Auto Trait Implementations§
impl Forget for StreamChannels
impl Freeze for StreamChannels
impl RefUnwindSafe for StreamChannels
impl Send for StreamChannels
impl Sync for StreamChannels
impl Unpin for StreamChannels
impl UnsafeUnpin for StreamChannels
impl UnwindSafe for StreamChannels
Blanket Implementations§
impl<T> AsId for T
impl<T> AsIdSalt for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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