csv_lib/extensions/row_extension.rs
1use crate::models::in_row_iter::InRowIter;
2
3#[allow(dead_code)]
4pub(crate) trait IterableRow<'mmap> {
5 /// ## Get Iterator
6 ///
7 /// Extracts the `InRowIter` struct.
8 /// This struct, can move inside the raw row, without copy or allocation.
9 /// - `returns`: `InRowIter<'a>`
10 fn get_iterator(self, del : u8, separator : u8) -> InRowIter<'mmap>;
11}
12
13
14//Implementation of the trait
15
16impl<'mmap> IterableRow<'mmap> for &'mmap [u8] {
17 fn get_iterator(self, delimiter : u8, separator : u8) -> InRowIter<'mmap> {
18 InRowIter::new(
19 self,
20 delimiter,
21 separator,
22 )
23 }
24}
25
26