-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sparse accessor iterators #246
Conversation
src/accessor/util.rs
Outdated
fn buffer_view_slice<'a, 's, F>(view: buffer::View<'a>, get_buffer_data: F) -> &'s [u8] | ||
where F: Fn(buffer::Buffer<'a>) -> Option<&'s [u8]>, | ||
{ | ||
let big_slice = get_buffer_data(view.buffer()).unwrap(); // TODO: don't unwrap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: don't unwrap()
Fix me
|
||
/// General iterator for an accessor. | ||
#[derive(Clone, Debug)] | ||
pub enum Iter<'a, T: Item> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider making Accessor
an enum too
src/accessor/util.rs
Outdated
where F: Clone + Fn(buffer::Buffer<'a>) -> Option<&'s [u8]>, | ||
{ | ||
let is_sparse = accessor.sparse().is_some(); | ||
Some(if is_sparse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some(
Fix me: return None
if get_buffer_data
fails.
631fc05
to
3ee6472
Compare
3ee6472
to
69f6de1
Compare
69f6de1
to
16d807e
Compare
This trait was implemented for `Iter` prior to 0.14. It appears that the missing trait implementation was an oversight when sparse accessors were implemented in gltf-rs#246.
Fixes #154