1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-01 05:27:45 +00:00
This commit is contained in:
electricboogie 2021-04-18 15:52:48 -05:00
parent 559f4e81f6
commit deb94cef7a

View file

@ -264,11 +264,8 @@ impl Sortable for Line {
.unwrap(); .unwrap();
} }
// This crate asks us to write one Line at a time, but returns multiple Lines to us(?). // This crate asks us to write one Line struct at a time, but then returns multiple Lines to us at once.
// However, this crate also expects us to return a result of Option<Line>, // We concatanate them and return them as one big Line here.
// so we concat the these lines into a single Option<Line>. So, it's possible this is broken,
// and/or needs to be tested more thoroughly. Perhaps we need to rethink our Line struct or rewrite a
// ext sorter ourselves.
fn decode<R: Read>(read: &mut R) -> Option<Line> { fn decode<R: Read>(read: &mut R) -> Option<Line> {
let buf_reader = BufReader::new(read); let buf_reader = BufReader::new(read);
let result = { let result = {
@ -278,7 +275,7 @@ impl Sortable for Line {
for line in p_iter { for line in p_iter {
let mut deserialized_line: Line = serde_json::from_str(&line.unwrap()).unwrap(); let mut deserialized_line: Line = serde_json::from_str(&line.unwrap()).unwrap();
line_joined = format!("{}\n{}\n", line_joined, deserialized_line.line); line_joined = format!("{}\n{}\n", line_joined, deserialized_line.line);
// I think we've done our sorting already and these are irrelevant? // I think we've done our sorting already and these selctions are irrelevant?
// @miDeb what's your sense? Could we just return an empty vec? // @miDeb what's your sense? Could we just return an empty vec?
selections_joined.append(&mut deserialized_line.selections); selections_joined.append(&mut deserialized_line.selections);
} }