Crates.io | o5m-stream |
lib.rs | o5m-stream |
version | 2.0.0 |
source | src |
created_at | 2021-04-09 09:07:27.900853 |
updated_at | 2021-06-24 22:50:37.747902 |
description | streaming async o5m decoder |
homepage | https://github.com/peermaps/o5m-stream.rs |
repository | https://github.com/peermaps/o5m-stream.rs |
max_upload_size | |
id | 381202 |
size | 45,892 |
streaming async o5m decoder
use async_std::{prelude::*,fs::File,io};
type Error = Box<dyn std::error::Error+Send+Sync>;
type R = Box<dyn io::Read+Send+Unpin>;
#[async_std::main]
async fn main() -> Result<(),Error> {
let args = std::env::args().collect::<Vec<String>>();
let infile: R = match args.get(1).unwrap_or(&"-".into()).as_str() {
"-" => Box::new(io::stdin()),
x => Box::new(File::open(x).await?),
};
let mut stream = o5m_stream::decode(infile);
while let Some(result) = stream.next().await {
let r = result?;
println!["{:?}", r];
}
Ok(())
}
bsd