pub struct VfsSnapshot { /* private fields */ }Expand description
A snapshot of the virtual filesystem state.
Captures all files, directories, and symlinks. Can be serialized with serde for persistence across sessions.
§Example
use bashkit::{FileSystem, InMemoryFs};
use std::path::Path;
let fs = InMemoryFs::new();
fs.write_file(Path::new("/tmp/test.txt"), b"hello").await?;
let snapshot = fs.snapshot();
// Serialize to JSON
let json = serde_json::to_string(&snapshot).unwrap();
// Deserialize and restore
let restored: bashkit::VfsSnapshot = serde_json::from_str(&json).unwrap();
let fs2 = InMemoryFs::new();
fs2.restore(&restored);
let content = fs2.read_file(Path::new("/tmp/test.txt")).await?;
assert_eq!(content, b"hello");Trait Implementations§
Source§impl Clone for VfsSnapshot
impl Clone for VfsSnapshot
Source§fn clone(&self) -> VfsSnapshot
fn clone(&self) -> VfsSnapshot
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VfsSnapshot
impl Debug for VfsSnapshot
Source§impl<'de> Deserialize<'de> for VfsSnapshot
impl<'de> Deserialize<'de> for VfsSnapshot
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for VfsSnapshot
impl RefUnwindSafe for VfsSnapshot
impl Send for VfsSnapshot
impl Sync for VfsSnapshot
impl Unpin for VfsSnapshot
impl UnsafeUnpin for VfsSnapshot
impl UnwindSafe for VfsSnapshot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more