fn buffer_data(&self, buffer_view: usize) -> Result<&[u8], ModelError> {
        let view = self
            .gltf
            .buffer_views
            .get(buffer_view)
            .ok_or_else(|| ModelError::BadIndex {
                array: "Buffer views",
                got: buffer_view,
                max: self.gltf.buffer_views.len(),
            })?;

        let buffer = self
            .buffers
            .get(view.buffer)
            .ok_or_else(|| ModelError::BadIndex {
                array: "Buffers",
                got: view.buffer,
                max: self.buffers.len(),
            })?;

        Ok(buffer
            .data
            .get(view.byte_offset..(view.byte_offset + view.byte_length))
            .ok_or_else(|| ModelError::BadIndex {
                array: "Buffer get",
                got: view.byte_offset + view.byte_length,
                max: buffer.data.len(),
            })?)
    }
// try to get a reference to the data from a buffer view
try to get a reference to the data from a buffer view
try to get a reference to the data from a buffer view
fn buffer_data(&self, buffer_view: usize) -> Result<&[u8], ModelError> {
        let view = self
            .gltf
            .buffer_views
            .get(buffer_view)
            .ok_or_else(|| ModelError::BadIndex {
                array: "Buffer views",
                got: buffer_view,
                max: self.gltf.buffer_views.len(),
            })?;
        let buffer = self
            .buffers
            .get(view.buffer)
            .ok_or_else(|| ModelError::BadIndex {
                array: "Buffers",
                got: view.buffer,
                max: self.buffers.len(),
            })?;
        Ok(buffer
            .data
            .get(view.byte_offset..(view.byte_offset + view.byte_length))
            .ok_or_else(|| ModelError::BadIndex {
                array: "Buffer get",
                got: view.byte_offset + view.byte_length,
                max: buffer.data.len(),
            })?)
    }
fn buffer_data ( & self , buffer_view : usize ) -> Result < & [ u8 ] , ModelError > { let view = self . gltf . buffer_views . get ( buffer_view ) . ok_or_else ( | | ModelError :: BadIndex { array : " " , got : buffer_view , max : self . gltf . buffer_views . len ( ) , } ) ? ; let buffer = self . buffers . get ( view . buffer ) . ok_or_else ( | | ModelError :: BadIndex { array : " " , got : view . buffer , max : self . buffers . len ( ) , } ) ? ; Ok ( buffer . data . get ( view . byte_offset .. ( view . byte_offset + view . byte_length ) ) . ok_or_else ( | | ModelError :: BadIndex { array : " " , got : view . byte_offset + view . byte_length , max : buffer . data . len ( ) , } ) ? ) }
try to get a reference to the data from a buffer view
try to get a reference to the data from a buffer view
&self
buffer_view
usize
&self
buffer_view
usize