]> Witch of Git - jade-rose/blob - toolchain/src/lib.rs
Update spec
[jade-rose] / toolchain / src / lib.rs
1 pub mod inst;
2
3 pub use inst::{decode::Decode, Inst};
4 use std::io;
5
6 pub fn disassemble(reader: &mut impl io::Read) -> io::Result<Vec<Inst>> {
7 let mut results = Vec::new();
8 loop {
9 match Inst::decode(reader) {
10 Ok(inst) => results.push(inst),
11 Err(err) if err.kind() == io::ErrorKind::UnexpectedEof => break,
12 Err(err) => return Err(err),
13 }
14 }
15 Ok(results)
16 }