diff options
-rw-r--r-- | src/lib.rs | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -501,6 +501,24 @@ pub struct FieldSliceMut<'mv> impl FieldSliceMut<'_> { + pub fn get_item_mut(&mut self, item_index: usize) -> Option<FieldMut<'_>> + { + let start_off = item_index * self.field_metadata.size; + + if item_index >= self.len { + return None; + } + + let field_bytes = self + .bytes + .get_mut(start_off..start_off + self.field_metadata.size)?; + + Some(FieldMut { + bytes: field_bytes, + field_metadata: self.field_metadata, + }) + } + pub fn iter_mut(&mut self) -> FieldSliceIterMut<'_> { FieldSliceIterMut { |