Download crates/forge_repo/src/fs_snap.rs from SaylorTwift/forgecode: direct link, hf CLI and curl.
- Browser
- Download file 807 Bytes
-
https://huggingface.co/SaylorTwift/forgecode/resolve/main/crates/forge_repo/src/fs_snap.rs
- Command line
-
hf download hf://SaylorTwift/forgecode/crates/forge_repo/src/fs_snap.rs
-
curl -L -o fs_snap.rs https://huggingface.co/SaylorTwift/forgecode/resolve/main/crates/forge_repo/src/fs_snap.rs
807 Bytes
| use std::path::Path; | |
| use std::sync::Arc; | |
| use anyhow::Result; | |
| use forge_domain::{Environment, Snapshot, SnapshotRepository}; | |
| pub struct ForgeFileSnapshotService { | |
| inner: Arc<forge_snaps::SnapshotService>, | |
| } | |
| impl ForgeFileSnapshotService { | |
| pub fn new(env: Environment) -> Self { | |
| Self { | |
| inner: Arc::new(forge_snaps::SnapshotService::new(env.snapshot_path())), | |
| } | |
| } | |
| } | |
| impl SnapshotRepository for ForgeFileSnapshotService { | |
| // Creation | |
| async fn insert_snapshot(&self, file_path: &Path) -> Result<Snapshot> { | |
| self.inner.create_snapshot(file_path.to_path_buf()).await | |
| } | |
| // Undo | |
| async fn undo_snapshot(&self, file_path: &Path) -> Result<()> { | |
| self.inner.undo_snapshot(file_path.to_path_buf()).await | |
| } | |
| } | |