pub fn bind<'a, C>(
        &'a self,
        formats: &[VertexFormat<'_>],
        encoder: &mut EncoderCommon<'_, B, C>,
    ) -> Result<u32, Incompatible>
    where
        C: Supports<Graphics>,
    {
        debug_assert!(is_slice_sorted(formats));
        debug_assert!(is_slice_sorted_by_key(&self.vbufs, |vbuf| &vbuf.format));

        let mut vertex = smallvec::SmallVec::<[_; 16]>::new();

        let mut next = 0;
        for format in formats {
            if let Some(index) = find_compatible_buffer(&self.vbufs[next..], format) {
                // Ensure buffer is valid
                vertex.push((self.vbufs[index].buffer.raw(), 0));
                next = index + 1;
            } else {
                // Can't bind
                return Err(Incompatible);
            }
        }
        match self.ibuf.as_ref() {
            Some(ibuf) => {
                encoder.bind_index_buffer(ibuf.buffer.raw(), 0, ibuf.index_type);
                encoder.bind_vertex_buffers(0, vertex.iter().cloned());
            }
            None => {
                encoder.bind_vertex_buffers(0, vertex.iter().cloned());
            }
        }

        Ok(self.len)
    }
/// Bind buffers to specified attribute locations.
Bind buffers to specified attribute locations.
Bind buffers to specified attribute locations .
pub fn bind<'a, C>(
        &'a self,
        formats: &[VertexFormat<'_>],
        encoder: &mut EncoderCommon<'_, B, C>,
    ) -> Result<u32, Incompatible>
    where
        C: Supports<Graphics>,
    {
        debug_assert!(is_slice_sorted(formats));
        debug_assert!(is_slice_sorted_by_key(&self.vbufs, |vbuf| &vbuf.format));
        let mut vertex = smallvec::SmallVec::<[_; 16]>::new();
        let mut next = 0;
        for format in formats {
            if let Some(index) = find_compatible_buffer(&self.vbufs[next..], format) {
                // Ensure buffer is valid
                vertex.push((self.vbufs[index].buffer.raw(), 0));
                next = index + 1;
            } else {
                // Can't bind
                return Err(Incompatible);
            }
        }
        match self.ibuf.as_ref() {
            Some(ibuf) => {
                encoder.bind_index_buffer(ibuf.buffer.raw(), 0, ibuf.index_type);
                encoder.bind_vertex_buffers(0, vertex.iter().cloned());
            }
            None => {
                encoder.bind_vertex_buffers(0, vertex.iter().cloned());
            }
        }
        Ok(self.len)
    }
pub fn bind < ' a , C > ( & ' a self , formats : & [ VertexFormat < ' _ > ] , encoder : & mut EncoderCommon < ' _ , B , C > , ) -> Result < u32 , Incompatible > where C : Supports < Graphics > , { debug_assert ! ( is_slice_sorted ( formats ) ) ; debug_assert ! ( is_slice_sorted_by_key ( self vbufs vbuf vbuf format ) ) ; let mut vertex = smallvec :: SmallVec :: < [ _ ; 16 ] > :: new ( ) ; let mut next = 0 ; for format in formats { if let Some ( index ) = find_compatible_buffer ( & self . vbufs [ next .. ] , format ) { // Ensure buffer is valid vertex . push ( ( self . vbufs [ index ] . buffer . raw ( ) , 0 ) ) ; next = index + 1 ; } else { // Can't bind return Err ( Incompatible ) ; } } match self . ibuf . as_ref ( ) { Some ( ibuf ) => { encoder . bind_index_buffer ( ibuf . buffer . raw ( ) , 0 , ibuf . index_type ) ; encoder . bind_vertex_buffers ( 0 , vertex . iter ( ) . cloned ( ) ) ; } None => { encoder . bind_vertex_buffers ( 0 , vertex . iter ( ) . cloned ( ) ) ; } } Ok ( self . len ) }
Bind buffers to specified attribute locations.
Bind buffers to specified attribute locations .
&'a self
formats
&[VertexFormat<'_>]
encoder
&mut EncoderCommon<'_, B, C>
&'a self
formats
&[VertexFormat<'_>]
encoder
&mut EncoderCommon<'_, B, C>