mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-24 22:56:02 +00:00
Add builder-ish methods to InstanceSnapshot to make middleware code more readable
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use crate::{
|
||||
snapshot::InstanceSnapshot,
|
||||
snapshot::{InstanceMetadata, InstanceSnapshot},
|
||||
vfs::{Vfs, VfsEntry, VfsFetcher},
|
||||
};
|
||||
|
||||
@@ -36,10 +34,13 @@ impl SnapshotMiddleware for SnapshotRbxlx {
|
||||
|
||||
let root_id = temp_tree.get_root_id();
|
||||
|
||||
let mut snapshot = InstanceSnapshot::from_tree(&temp_tree, root_id);
|
||||
snapshot.name = Cow::Owned(instance_name.to_owned());
|
||||
snapshot.metadata.instigating_source = Some(entry.path().to_path_buf().into());
|
||||
snapshot.metadata.relevant_paths = vec![entry.path().to_path_buf()];
|
||||
let snapshot = InstanceSnapshot::from_tree(&temp_tree, root_id)
|
||||
.name(instance_name)
|
||||
.metadata(InstanceMetadata {
|
||||
instigating_source: Some(entry.path().to_path_buf().into()),
|
||||
relevant_paths: vec![entry.path().to_path_buf()],
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
Ok(Some(snapshot))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user