diff options
-rw-r--r-- | src/lib.rs | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -230,7 +230,7 @@ impl MultiVec /// Returns a slice containing the specified field of all items. #[must_use] - pub fn get_field(&self, field_index: usize) -> FieldSlice<'_> + pub fn get_field_slice(&self, field_index: usize) -> FieldSlice<'_> { let field_arr_byte_offset = self.field_arr_byte_offsets[field_index]; @@ -250,7 +250,7 @@ impl MultiVec /// Returns a slice containing the specified field of all items. #[must_use] - pub fn get_field_mut(&mut self, field_index: usize) -> FieldSliceMut<'_> + pub fn get_field_slice_mut(&mut self, field_index: usize) -> FieldSliceMut<'_> { let field_arr_byte_offset = self.field_arr_byte_offsets[field_index]; @@ -453,7 +453,7 @@ impl Drop for MultiVec assert_eq!(self.field_metadata.len(), self.field_arr_byte_offsets.len()); for field_index in 0..self.field_arr_byte_offsets.len() { - for field in self.get_field_mut(field_index).iter_mut() { + for field in self.get_field_slice_mut(field_index).iter_mut() { let field_ptr = field.bytes.as_mut_ptr(); unsafe { @@ -858,7 +858,7 @@ mod tests //} #[test] - fn get_field_works_when_two_fields() + fn get_field_slice_works_when_two_fields() { let mut data; let multi_vec = multi_vec_with_data!( @@ -871,18 +871,18 @@ mod tests ); assert_eq!( - multi_vec.get_field(0).as_slice::<u32>(), + multi_vec.get_field_slice(0).as_slice::<u32>(), [u32::MAX - 3000, 901, 5560000] ); assert_eq!( - multi_vec.get_field(1).as_slice::<u16>(), + multi_vec.get_field_slice(1).as_slice::<u16>(), [20210, 7120, 1010] ); } #[test] - fn get_field_works_when_three_fields() + fn get_field_slice_works_when_three_fields() { let mut data; let multi_vec = multi_vec_with_data!( @@ -896,16 +896,19 @@ mod tests ); assert_eq!( - multi_vec.get_field(0).as_slice::<u32>(), + multi_vec.get_field_slice(0).as_slice::<u32>(), [123, 888, 1910, 11144, 770077] ); assert_eq!( - multi_vec.get_field(1).as_slice::<String>(), + multi_vec.get_field_slice(1).as_slice::<String>(), ["No,", "I", "am", "your", "father",] ); - assert_eq!(multi_vec.get_field(2).as_slice::<u8>(), [120, 88, 54, 3, 7]); + assert_eq!( + multi_vec.get_field_slice(2).as_slice::<u8>(), + [120, 88, 54, 3, 7] + ); } #[test] |