use std::io; use std::io::Read; use std::sync::Arc; use preserves2::*; #[test] fn read_samples_text() -> io::Result<()> { let mut fh = std::fs::File::open("./tests/samples.pr")?; let mut contents = String::new(); fh.read_to_string(&mut contents)?; println!("{:#?}", IOValue::from_str(&contents, true)?); Ok(()) } #[test] fn read_samples_bin() -> io::Result<()> { let mut fh = std::fs::File::open("./tests/samples.bin")?; let mut contents = Vec::new(); fh.read_to_end(&mut contents)?; println!("{:#?}", IOValue::from_bytes(&contents, true)?); Ok(()) } #[test] fn read_samples_view() -> io::Result<()> { let mut fh = std::fs::File::open("./tests/samples.bin")?; let mut contents = Vec::new(); fh.read_to_end(&mut contents)?; let v = packed::view::View::new::(Arc::from(contents), None)?; println!("{:#?}", IOValue::new(v)); Ok(()) }