Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn test_save() {
- let mut snapshot = Snapshot::new(Path::new("/tmp/snap.fcs")).unwrap();
- let p = Test_v1 {
- field1: 10,
- field2: "Andrei".to_owned(),
- field3: vec![1; 3],
- };
- println!("Saving struct as {:?}", &p);
- snapshot.store_object("test_object".to_owned(), 1, &p);
- snapshot.save(1, "Testing".to_owned()).unwrap();
- snapshot = Snapshot::load(Path::new("/tmp/snap.fcs")).unwrap();
- let x: Test_v3 = snapshot.restore_object("test_object".to_owned());
- let y: Test_v2 = snapshot.restore_object("test_object".to_owned());
- let z: Test_v1 = snapshot.restore_object("test_object".to_owned());
- println!("Restore as {:?}", x);
- println!("Restore as {:?}", y);
- println!("Restore as {:?}", z);
- assert!(false);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement