Advertisement
Guest User

Untitled

a guest
Jul 9th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.56 KB | None | 0 0
  1.   let serial = serde_json::to_string(&a).unwrap();
  2.   let mut f = BufWriter::new(File::create("/tmp/foo.bar").unwrap());
  3.   serialize_into(&mut f, &a).unwrap();
  4.  
  5.   let f = File::open("/tmp/foo.bar").unwrap();
  6.   let mut rdr = BufReader::new(f);
  7.   let decoded: ndarray::ArrayBase<ndarray::OwnedRepr<f32>, ndarray::Dim<[usize; 1]>> = deserialize_from(&mut rdr).unwrap();
  8.  
  9. // thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Io(Custom { kind: UnexpectedEof, error: StringError("failed to fill whole buffer") })', src/libcore/result.rs:997:5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement