Actually do skipping Nones in output

This commit is contained in:
Skye 2023-12-16 16:58:58 -05:00
parent ad1d0bde35
commit 9c210468fe

View file

@ -1,6 +1,6 @@
use crate::tile::{Block, TileData}; use crate::tile::{Block, TileData};
use eyre::OptionExt; use eyre::OptionExt;
use serde::{Serialize, ser::SerializeSeq}; use serde::{ser::SerializeSeq, Serialize};
use std::sync::Arc; use std::sync::Arc;
use tokio::{ use tokio::{
io::{self, AsyncWriteExt}, io::{self, AsyncWriteExt},
@ -51,7 +51,7 @@ pub async fn run(num_tiles: usize, mut receiver: mpsc::Receiver<TileData>) -> ey
continue; continue;
}; };
*block = Some(message.block); *block = Some(message.block);
let mut serialized = serde_json::to_vec(&blocks).unwrap(); let mut serialized = serde_json::to_vec(&NoneSkipper(&blocks)).unwrap();
serialized.extend_from_slice(b",\n"); serialized.extend_from_slice(b",\n");
stdout.write_all(&serialized).await?; stdout.write_all(&serialized).await?;
} }
@ -77,4 +77,4 @@ where
} }
seq.end() seq.end()
} }
} }