Skip to content

Commit e3beea7

Browse files
committed
Cleanup parsing
1 parent d3beb8d commit e3beea7

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

flatgfa/src/flatbed.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::gfaline::parse_field;
12
use crate::memfile::MemchrSplit;
23
use crate::pool::{FixedStore, HeapStore, Id, Pool, Span, Store};
34
use atoi::FromRadix10;
@@ -127,11 +128,8 @@ impl<'a, P: StoreFamily<'a>> BEDParser<'a, P> {
127128
/// Parse a BED text file from an in-memory buffer.
128129
pub fn parse_mem(mut self, buf: &[u8]) -> BEDStore<'a, P> {
129130
for line in MemchrSplit::new(b'\n', buf) {
130-
let first_tab_index = line.iter().position(|&x| x == b'\t').unwrap();
131-
let name_slice = &line[0..first_tab_index];
132-
133-
let rest_of_vec = &line[first_tab_index + 1..];
134-
let (start_num, rest) = parse_num(rest_of_vec).unwrap();
131+
let (name_slice, rest) = parse_field(line).unwrap();
132+
let (start_num, rest) = parse_num(rest).unwrap();
135133
let (end_num, _) = parse_num(&rest[1..]).unwrap();
136134

137135
self.flat.add_entry(name_slice, start_num, end_num);

0 commit comments

Comments
 (0)