#streaming #decoder #async-std #io #o5m

nightly o5m-stream

streaming async o5m decoder

8 stable releases

2.0.0 Jun 24, 2021
1.1.4 May 2, 2021
1.1.3 Apr 28, 2021

#237 in Video

27 downloads per month

BSD-3-Clause

26KB
744 lines

o5m-stream

streaming async o5m decoder

example

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(())
}

license

bsd

Dependencies

~6–16MB
~216K SLoC