(&self)
| 58 | |
| 59 | impl<Sep: Separator> FlatCsv<Sep> { |
| 60 | pub(crate) fn iter(&self) -> impl Iterator<Item = &str> { |
| 61 | self.value.to_str().ok().into_iter().flat_map(|value_str| { |
| 62 | let mut in_quotes = false; |
| 63 | value_str |
| 64 | .split(move |c| { |
| 65 | if in_quotes { |
| 66 | if c == '"' { |
| 67 | in_quotes = false; |
| 68 | } |
| 69 | false // dont split |
| 70 | } else { |
| 71 | if c == Sep::CHAR { |
| 72 | true // split |
| 73 | } else { |
| 74 | if c == '"' { |
| 75 | in_quotes = true; |
| 76 | } |
| 77 | false // dont split |
| 78 | } |
| 79 | } |
| 80 | }) |
| 81 | .map(|item| item.trim()) |
| 82 | }) |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | impl<Sep> From<HeaderValue> for FlatCsv<Sep> { |