Advertisement
Guest User

Untitled

a guest
Jul 9th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.50 KB | None | 0 0
  1.   let a = Array::from_vec(vec![0.1, 0.2]);
  2.   let mut w = BufWriter::new(File::create("/tmp/foo.bar").unwrap());
  3.   serialize_into(&mut w, &a).unwrap();
  4.  
  5.   let f = File::open("/tmp/foo.bar").unwrap();
  6.   let mut rdr = BufReader::new(f);
  7.   let decoded_a: ndarray::Array1<f32> = 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