Batch rename: imfs -> vfs

This commit is contained in:
Lucien Greathouse
2019-10-12 13:58:00 -07:00
parent 24c697bea7
commit 1031600c63
40 changed files with 539 additions and 545 deletions

View File

@@ -62,4 +62,4 @@ impl<T> Deref for IgnoreDebug<T> {
}
}
pub struct ImfsSnapshotContext;
pub struct VfsSnapshotContext;

View File

@@ -5,8 +5,8 @@ use rbx_dom_weak::RbxValue;
use serde::Serialize;
use crate::{
imfs::{FsResultExt, Imfs, ImfsEntry, ImfsFetcher},
snapshot::{InstanceMetadata, InstanceSnapshot},
vfs::{FsResultExt, Vfs, VfsEntry, VfsFetcher},
};
use super::{
@@ -19,10 +19,10 @@ use super::{
pub struct SnapshotCsv;
impl SnapshotMiddleware for SnapshotCsv {
fn from_imfs<F: ImfsFetcher>(
fn from_vfs<F: VfsFetcher>(
_context: &mut InstanceSnapshotContext,
imfs: &mut Imfs<F>,
entry: &ImfsEntry,
vfs: &mut Vfs<F>,
entry: &VfsEntry,
) -> SnapshotInstanceResult<'static> {
if entry.is_directory() {
return Ok(None);
@@ -37,7 +37,7 @@ impl SnapshotMiddleware for SnapshotCsv {
.path()
.with_file_name(format!("{}.meta.json", instance_name));
let table_contents = convert_localization_csv(entry.contents(imfs)?);
let table_contents = convert_localization_csv(entry.contents(vfs)?);
let mut snapshot = InstanceSnapshot {
snapshot_id: None,
@@ -56,8 +56,8 @@ impl SnapshotMiddleware for SnapshotCsv {
children: Vec::new(),
};
if let Some(meta_entry) = imfs.get(meta_path).with_not_found()? {
let meta_contents = meta_entry.contents(imfs)?;
if let Some(meta_entry) = vfs.get(meta_path).with_not_found()? {
let meta_contents = meta_entry.contents(vfs)?;
let mut metadata = AdjacentMetadata::from_slice(meta_contents);
metadata.apply_all(&mut snapshot);
}
@@ -146,23 +146,23 @@ fn convert_localization_csv(contents: &[u8]) -> String {
mod test {
use super::*;
use crate::imfs::{ImfsDebug, ImfsSnapshot, NoopFetcher};
use crate::vfs::{NoopFetcher, VfsDebug, VfsSnapshot};
use insta::assert_yaml_snapshot;
#[test]
fn csv_from_imfs() {
let mut imfs = Imfs::new(NoopFetcher);
let file = ImfsSnapshot::file(
fn csv_from_vfs() {
let mut vfs = Vfs::new(NoopFetcher);
let file = VfsSnapshot::file(
r#"
Key,Source,Context,Example,es
Ack,Ack!,,An exclamation of despair,¡Ay!"#,
);
imfs.debug_load_snapshot("/foo.csv", file);
vfs.debug_load_snapshot("/foo.csv", file);
let entry = imfs.get("/foo.csv").unwrap();
let entry = vfs.get("/foo.csv").unwrap();
let instance_snapshot =
SnapshotCsv::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotCsv::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.unwrap()
.unwrap();
@@ -171,20 +171,20 @@ Ack,Ack!,,An exclamation of despair,¡Ay!"#,
#[test]
fn csv_with_meta() {
let mut imfs = Imfs::new(NoopFetcher);
let file = ImfsSnapshot::file(
let mut vfs = Vfs::new(NoopFetcher);
let file = VfsSnapshot::file(
r#"
Key,Source,Context,Example,es
Ack,Ack!,,An exclamation of despair,¡Ay!"#,
);
let meta = ImfsSnapshot::file(r#"{ "ignoreUnknownInstances": true }"#);
let meta = VfsSnapshot::file(r#"{ "ignoreUnknownInstances": true }"#);
imfs.debug_load_snapshot("/foo.csv", file);
imfs.debug_load_snapshot("/foo.meta.json", meta);
vfs.debug_load_snapshot("/foo.csv", file);
vfs.debug_load_snapshot("/foo.meta.json", meta);
let entry = imfs.get("/foo.csv").unwrap();
let entry = vfs.get("/foo.csv").unwrap();
let instance_snapshot =
SnapshotCsv::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotCsv::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.unwrap()
.unwrap();

View File

@@ -3,35 +3,35 @@ use std::{borrow::Cow, collections::HashMap};
use rbx_dom_weak::{RbxId, RbxTree};
use crate::{
imfs::{DirectorySnapshot, Imfs, ImfsEntry, ImfsFetcher, ImfsSnapshot},
snapshot::{InstanceMetadata, InstanceSnapshot},
vfs::{DirectorySnapshot, Vfs, VfsEntry, VfsFetcher, VfsSnapshot},
};
use super::{
context::InstanceSnapshotContext,
error::SnapshotError,
middleware::{SnapshotFileResult, SnapshotInstanceResult, SnapshotMiddleware},
snapshot_from_imfs, snapshot_from_instance,
snapshot_from_instance, snapshot_from_vfs,
};
pub struct SnapshotDir;
impl SnapshotMiddleware for SnapshotDir {
fn from_imfs<F: ImfsFetcher>(
fn from_vfs<F: VfsFetcher>(
context: &mut InstanceSnapshotContext,
imfs: &mut Imfs<F>,
entry: &ImfsEntry,
vfs: &mut Vfs<F>,
entry: &VfsEntry,
) -> SnapshotInstanceResult<'static> {
if entry.is_file() {
return Ok(None);
}
let children: Vec<ImfsEntry> = entry.children(imfs)?;
let children: Vec<VfsEntry> = entry.children(vfs)?;
let mut snapshot_children = Vec::new();
for child in children.into_iter() {
if let Some(child_snapshot) = snapshot_from_imfs(context, imfs, &child)? {
if let Some(child_snapshot) = snapshot_from_vfs(context, vfs, &child)? {
snapshot_children.push(child_snapshot);
}
}
@@ -73,7 +73,7 @@ impl SnapshotMiddleware for SnapshotDir {
}
}
let snapshot = ImfsSnapshot::Directory(DirectorySnapshot { children });
let snapshot = VfsSnapshot::Directory(DirectorySnapshot { children });
Some((instance.name.clone(), snapshot))
}
@@ -86,18 +86,18 @@ mod test {
use insta::assert_yaml_snapshot;
use maplit::hashmap;
use crate::imfs::{ImfsDebug, NoopFetcher};
use crate::vfs::{NoopFetcher, VfsDebug};
#[test]
fn empty_folder() {
let mut imfs = Imfs::new(NoopFetcher);
let dir = ImfsSnapshot::dir::<String>(HashMap::new());
let mut vfs = Vfs::new(NoopFetcher);
let dir = VfsSnapshot::dir::<String>(HashMap::new());
imfs.debug_load_snapshot("/foo", dir);
vfs.debug_load_snapshot("/foo", dir);
let entry = imfs.get("/foo").unwrap();
let entry = vfs.get("/foo").unwrap();
let instance_snapshot =
SnapshotDir::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotDir::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.unwrap()
.unwrap();
@@ -106,16 +106,16 @@ mod test {
#[test]
fn folder_in_folder() {
let mut imfs = Imfs::new(NoopFetcher);
let dir = ImfsSnapshot::dir(hashmap! {
"Child" => ImfsSnapshot::dir::<String>(HashMap::new()),
let mut vfs = Vfs::new(NoopFetcher);
let dir = VfsSnapshot::dir(hashmap! {
"Child" => VfsSnapshot::dir::<String>(HashMap::new()),
});
imfs.debug_load_snapshot("/foo", dir);
vfs.debug_load_snapshot("/foo", dir);
let entry = imfs.get("/foo").unwrap();
let entry = vfs.get("/foo").unwrap();
let instance_snapshot =
SnapshotDir::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotDir::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.unwrap()
.unwrap();

View File

@@ -1,6 +1,6 @@
use std::{error::Error, fmt, io, path::PathBuf};
use crate::imfs::FsError;
use crate::vfs::FsError;
#[derive(Debug)]
pub struct SnapshotError {

View File

@@ -5,8 +5,8 @@ use rbx_reflection::try_resolve_value;
use serde::Deserialize;
use crate::{
imfs::{Imfs, ImfsEntry, ImfsFetcher},
snapshot::InstanceSnapshot,
vfs::{Vfs, VfsEntry, VfsFetcher},
};
use super::{
@@ -18,10 +18,10 @@ use super::{
pub struct SnapshotJsonModel;
impl SnapshotMiddleware for SnapshotJsonModel {
fn from_imfs<F: ImfsFetcher>(
fn from_vfs<F: VfsFetcher>(
_context: &mut InstanceSnapshotContext,
imfs: &mut Imfs<F>,
entry: &ImfsEntry,
vfs: &mut Vfs<F>,
entry: &VfsEntry,
) -> SnapshotInstanceResult<'static> {
if entry.is_directory() {
return Ok(None);
@@ -33,7 +33,7 @@ impl SnapshotMiddleware for SnapshotJsonModel {
};
let instance: JsonModel =
serde_json::from_slice(entry.contents(imfs)?).expect("TODO: Handle serde_json errors");
serde_json::from_slice(entry.contents(vfs)?).expect("TODO: Handle serde_json errors");
if let Some(json_name) = &instance.name {
if json_name != &instance_name {
@@ -137,12 +137,12 @@ mod test {
use insta::assert_yaml_snapshot;
use crate::imfs::{ImfsDebug, ImfsSnapshot, NoopFetcher};
use crate::vfs::{NoopFetcher, VfsDebug, VfsSnapshot};
#[test]
fn model_from_imfs() {
let mut imfs = Imfs::new(NoopFetcher);
let file = ImfsSnapshot::file(
fn model_from_vfs() {
let mut vfs = Vfs::new(NoopFetcher);
let file = VfsSnapshot::file(
r#"
{
"Name": "children",
@@ -160,16 +160,13 @@ mod test {
"#,
);
imfs.debug_load_snapshot("/foo.model.json", file);
vfs.debug_load_snapshot("/foo.model.json", file);
let entry = imfs.get("/foo.model.json").unwrap();
let instance_snapshot = SnapshotJsonModel::from_imfs(
&mut InstanceSnapshotContext::default(),
&mut imfs,
&entry,
)
.unwrap()
.unwrap();
let entry = vfs.get("/foo.model.json").unwrap();
let instance_snapshot =
SnapshotJsonModel::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.unwrap()
.unwrap();
assert_yaml_snapshot!(instance_snapshot);
}

View File

@@ -4,8 +4,8 @@ use maplit::hashmap;
use rbx_dom_weak::RbxValue;
use crate::{
imfs::{FsResultExt, Imfs, ImfsEntry, ImfsFetcher},
snapshot::{InstanceMetadata, InstanceSnapshot},
vfs::{FsResultExt, Vfs, VfsEntry, VfsFetcher},
};
use super::{
@@ -19,10 +19,10 @@ use super::{
pub struct SnapshotLua;
impl SnapshotMiddleware for SnapshotLua {
fn from_imfs<F: ImfsFetcher>(
fn from_vfs<F: VfsFetcher>(
context: &mut InstanceSnapshotContext,
imfs: &mut Imfs<F>,
entry: &ImfsEntry,
vfs: &mut Vfs<F>,
entry: &VfsEntry,
) -> SnapshotInstanceResult<'static> {
let file_name = entry.path().file_name().unwrap().to_string_lossy();
@@ -34,15 +34,15 @@ impl SnapshotMiddleware for SnapshotLua {
}
if entry.is_file() {
snapshot_lua_file(imfs, entry)
snapshot_lua_file(vfs, entry)
} else {
if let Some(snapshot) = snapshot_init(context, imfs, entry, "init.lua")? {
if let Some(snapshot) = snapshot_init(context, vfs, entry, "init.lua")? {
// An `init.lua` file turns its parent into a ModuleScript
Ok(Some(snapshot))
} else if let Some(snapshot) = snapshot_init(context, imfs, entry, "init.server.lua")? {
} else if let Some(snapshot) = snapshot_init(context, vfs, entry, "init.server.lua")? {
// An `init.server.lua` file turns its parent into a Script
Ok(Some(snapshot))
} else if let Some(snapshot) = snapshot_init(context, imfs, entry, "init.client.lua")? {
} else if let Some(snapshot) = snapshot_init(context, vfs, entry, "init.client.lua")? {
// An `init.client.lua` file turns its parent into a LocalScript
Ok(Some(snapshot))
} else {
@@ -53,9 +53,9 @@ impl SnapshotMiddleware for SnapshotLua {
}
/// Core routine for turning Lua files into snapshots.
fn snapshot_lua_file<F: ImfsFetcher>(
imfs: &mut Imfs<F>,
entry: &ImfsEntry,
fn snapshot_lua_file<F: VfsFetcher>(
vfs: &mut Vfs<F>,
entry: &VfsEntry,
) -> SnapshotInstanceResult<'static> {
let file_name = entry.path().file_name().unwrap().to_string_lossy();
@@ -70,7 +70,7 @@ fn snapshot_lua_file<F: ImfsFetcher>(
return Ok(None);
};
let contents = entry.contents(imfs)?;
let contents = entry.contents(vfs)?;
let contents_str = str::from_utf8(contents)
// TODO: Turn into error type
.expect("File content was not valid UTF-8")
@@ -101,8 +101,8 @@ fn snapshot_lua_file<F: ImfsFetcher>(
children: Vec::new(),
};
if let Some(meta_entry) = imfs.get(meta_path).with_not_found()? {
let meta_contents = meta_entry.contents(imfs)?;
if let Some(meta_entry) = vfs.get(meta_path).with_not_found()? {
let meta_contents = meta_entry.contents(vfs)?;
let mut metadata = AdjacentMetadata::from_slice(meta_contents);
metadata.apply_all(&mut snapshot);
}
@@ -115,17 +115,17 @@ fn snapshot_lua_file<F: ImfsFetcher>(
///
/// Scripts named `init.lua`, `init.server.lua`, or `init.client.lua` usurp
/// their parents, which acts similarly to `__init__.py` from the Python world.
fn snapshot_init<F: ImfsFetcher>(
fn snapshot_init<F: VfsFetcher>(
context: &mut InstanceSnapshotContext,
imfs: &mut Imfs<F>,
folder_entry: &ImfsEntry,
vfs: &mut Vfs<F>,
folder_entry: &VfsEntry,
init_name: &str,
) -> SnapshotInstanceResult<'static> {
let init_path = folder_entry.path().join(init_name);
if let Some(init_entry) = imfs.get(init_path).with_not_found()? {
if let Some(dir_snapshot) = SnapshotDir::from_imfs(context, imfs, folder_entry)? {
if let Some(mut init_snapshot) = snapshot_lua_file(imfs, &init_entry)? {
if let Some(init_entry) = vfs.get(init_path).with_not_found()? {
if let Some(dir_snapshot) = SnapshotDir::from_vfs(context, vfs, folder_entry)? {
if let Some(mut init_snapshot) = snapshot_lua_file(vfs, &init_entry)? {
init_snapshot.name = dir_snapshot.name;
init_snapshot.children = dir_snapshot.children;
// TODO: Metadata
@@ -145,18 +145,18 @@ mod test {
use insta::{assert_yaml_snapshot, with_settings};
use crate::imfs::{ImfsDebug, ImfsSnapshot, NoopFetcher};
use crate::vfs::{NoopFetcher, VfsDebug, VfsSnapshot};
#[test]
fn module_from_imfs() {
let mut imfs = Imfs::new(NoopFetcher);
let file = ImfsSnapshot::file("Hello there!");
fn module_from_vfs() {
let mut vfs = Vfs::new(NoopFetcher);
let file = VfsSnapshot::file("Hello there!");
imfs.debug_load_snapshot("/foo.lua", file);
vfs.debug_load_snapshot("/foo.lua", file);
let entry = imfs.get("/foo.lua").unwrap();
let entry = vfs.get("/foo.lua").unwrap();
let instance_snapshot =
SnapshotLua::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotLua::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.unwrap()
.unwrap();
@@ -164,15 +164,15 @@ mod test {
}
#[test]
fn server_from_imfs() {
let mut imfs = Imfs::new(NoopFetcher);
let file = ImfsSnapshot::file("Hello there!");
fn server_from_vfs() {
let mut vfs = Vfs::new(NoopFetcher);
let file = VfsSnapshot::file("Hello there!");
imfs.debug_load_snapshot("/foo.server.lua", file);
vfs.debug_load_snapshot("/foo.server.lua", file);
let entry = imfs.get("/foo.server.lua").unwrap();
let entry = vfs.get("/foo.server.lua").unwrap();
let instance_snapshot =
SnapshotLua::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotLua::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.unwrap()
.unwrap();
@@ -180,15 +180,15 @@ mod test {
}
#[test]
fn client_from_imfs() {
let mut imfs = Imfs::new(NoopFetcher);
let file = ImfsSnapshot::file("Hello there!");
fn client_from_vfs() {
let mut vfs = Vfs::new(NoopFetcher);
let file = VfsSnapshot::file("Hello there!");
imfs.debug_load_snapshot("/foo.client.lua", file);
vfs.debug_load_snapshot("/foo.client.lua", file);
let entry = imfs.get("/foo.client.lua").unwrap();
let entry = vfs.get("/foo.client.lua").unwrap();
let instance_snapshot =
SnapshotLua::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotLua::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.unwrap()
.unwrap();
@@ -197,9 +197,9 @@ mod test {
#[test]
fn module_with_meta() {
let mut imfs = Imfs::new(NoopFetcher);
let file = ImfsSnapshot::file("Hello there!");
let meta = ImfsSnapshot::file(
let mut vfs = Vfs::new(NoopFetcher);
let file = VfsSnapshot::file("Hello there!");
let meta = VfsSnapshot::file(
r#"
{
"ignoreUnknownInstances": true
@@ -207,12 +207,12 @@ mod test {
"#,
);
imfs.debug_load_snapshot("/foo.lua", file);
imfs.debug_load_snapshot("/foo.meta.json", meta);
vfs.debug_load_snapshot("/foo.lua", file);
vfs.debug_load_snapshot("/foo.meta.json", meta);
let entry = imfs.get("/foo.lua").unwrap();
let entry = vfs.get("/foo.lua").unwrap();
let instance_snapshot =
SnapshotLua::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotLua::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.unwrap()
.unwrap();
@@ -221,9 +221,9 @@ mod test {
#[test]
fn script_with_meta() {
let mut imfs = Imfs::new(NoopFetcher);
let file = ImfsSnapshot::file("Hello there!");
let meta = ImfsSnapshot::file(
let mut vfs = Vfs::new(NoopFetcher);
let file = VfsSnapshot::file("Hello there!");
let meta = VfsSnapshot::file(
r#"
{
"ignoreUnknownInstances": true
@@ -231,12 +231,12 @@ mod test {
"#,
);
imfs.debug_load_snapshot("/foo.server.lua", file);
imfs.debug_load_snapshot("/foo.meta.json", meta);
vfs.debug_load_snapshot("/foo.server.lua", file);
vfs.debug_load_snapshot("/foo.meta.json", meta);
let entry = imfs.get("/foo.server.lua").unwrap();
let entry = vfs.get("/foo.server.lua").unwrap();
let instance_snapshot =
SnapshotLua::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotLua::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.unwrap()
.unwrap();
@@ -245,9 +245,9 @@ mod test {
#[test]
fn script_disabled() {
let mut imfs = Imfs::new(NoopFetcher);
let file = ImfsSnapshot::file("Hello there!");
let meta = ImfsSnapshot::file(
let mut vfs = Vfs::new(NoopFetcher);
let file = VfsSnapshot::file("Hello there!");
let meta = VfsSnapshot::file(
r#"
{
"properties": {
@@ -257,12 +257,12 @@ mod test {
"#,
);
imfs.debug_load_snapshot("/bar.server.lua", file);
imfs.debug_load_snapshot("/bar.meta.json", meta);
vfs.debug_load_snapshot("/bar.server.lua", file);
vfs.debug_load_snapshot("/bar.meta.json", meta);
let entry = imfs.get("/bar.server.lua").unwrap();
let entry = vfs.get("/bar.server.lua").unwrap();
let instance_snapshot =
SnapshotLua::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotLua::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.unwrap()
.unwrap();

View File

@@ -3,20 +3,20 @@ use std::path::{Path, PathBuf};
use rbx_dom_weak::{RbxId, RbxTree};
use crate::{
imfs::{Imfs, ImfsEntry, ImfsFetcher, ImfsSnapshot},
snapshot::InstanceSnapshot,
vfs::{Vfs, VfsEntry, VfsFetcher, VfsSnapshot},
};
use super::{context::InstanceSnapshotContext, error::SnapshotError};
pub type SnapshotInstanceResult<'a> = Result<Option<InstanceSnapshot<'a>>, SnapshotError>;
pub type SnapshotFileResult = Option<(String, ImfsSnapshot)>;
pub type SnapshotFileResult = Option<(String, VfsSnapshot)>;
pub trait SnapshotMiddleware {
fn from_imfs<F: ImfsFetcher>(
fn from_vfs<F: VfsFetcher>(
context: &mut InstanceSnapshotContext,
imfs: &mut Imfs<F>,
entry: &ImfsEntry,
vfs: &mut Vfs<F>,
entry: &VfsEntry,
) -> SnapshotInstanceResult<'static>;
fn from_instance(_tree: &RbxTree, _id: RbxId) -> SnapshotFileResult {

View File

@@ -37,20 +37,20 @@ use self::{
txt::SnapshotTxt,
user_plugins::SnapshotUserPlugins,
};
use crate::imfs::{Imfs, ImfsEntry, ImfsFetcher};
use crate::vfs::{Vfs, VfsEntry, VfsFetcher};
macro_rules! middlewares {
( $($middleware: ident,)* ) => {
/// Generates a snapshot of instances from the given ImfsEntry.
pub fn snapshot_from_imfs<F: ImfsFetcher>(
/// Generates a snapshot of instances from the given VfsEntry.
pub fn snapshot_from_vfs<F: VfsFetcher>(
context: &mut InstanceSnapshotContext,
imfs: &mut Imfs<F>,
entry: &ImfsEntry,
vfs: &mut Vfs<F>,
entry: &VfsEntry,
) -> SnapshotInstanceResult<'static> {
$(
log::trace!("trying middleware {} on {}", stringify!($middleware), entry.path().display());
if let Some(snapshot) = $middleware::from_imfs(context, imfs, entry)? {
if let Some(snapshot) = $middleware::from_vfs(context, vfs, entry)? {
log::trace!("middleware {} success on {}", stringify!($middleware), entry.path().display());
return Ok(Some(snapshot));
}

View File

@@ -3,16 +3,16 @@ use std::{borrow::Cow, collections::HashMap};
use rbx_reflection::try_resolve_value;
use crate::{
imfs::{FsResultExt, Imfs, ImfsEntry, ImfsFetcher},
project::{Project, ProjectNode},
snapshot::{InstanceMetadata, InstanceSnapshot, InstigatingSource},
vfs::{FsResultExt, Vfs, VfsEntry, VfsFetcher},
};
use super::{
context::InstanceSnapshotContext,
error::SnapshotError,
middleware::{SnapshotInstanceResult, SnapshotMiddleware},
snapshot_from_imfs,
snapshot_from_vfs,
};
/// Handles snapshots for:
@@ -21,19 +21,19 @@ use super::{
pub struct SnapshotProject;
impl SnapshotMiddleware for SnapshotProject {
fn from_imfs<F: ImfsFetcher>(
fn from_vfs<F: VfsFetcher>(
context: &mut InstanceSnapshotContext,
imfs: &mut Imfs<F>,
entry: &ImfsEntry,
vfs: &mut Vfs<F>,
entry: &VfsEntry,
) -> SnapshotInstanceResult<'static> {
if entry.is_directory() {
let project_path = entry.path().join("default.project.json");
match imfs.get(project_path).with_not_found()? {
match vfs.get(project_path).with_not_found()? {
// TODO: Do we need to muck with the relevant paths if we're a
// project file within a folder? Should the folder path be the
// relevant path instead of the project file path?
Some(entry) => return SnapshotProject::from_imfs(context, imfs, &entry),
Some(entry) => return SnapshotProject::from_vfs(context, vfs, &entry),
None => return Ok(None),
}
}
@@ -43,13 +43,13 @@ impl SnapshotMiddleware for SnapshotProject {
return Ok(None);
}
let project = Project::load_from_slice(entry.contents(imfs)?, entry.path())
let project = Project::load_from_slice(entry.contents(vfs)?, entry.path())
.map_err(|err| SnapshotError::malformed_project(err, entry.path()))?;
// Snapshotting a project should always return an instance, so this
// unwrap is safe.
let mut snapshot =
snapshot_project_node(context, &project.name, &project.tree, imfs)?.unwrap();
snapshot_project_node(context, &project.name, &project.tree, vfs)?.unwrap();
// Setting the instigating source to the project file path is a little
// coarse.
@@ -76,11 +76,11 @@ impl SnapshotMiddleware for SnapshotProject {
}
}
fn snapshot_project_node<F: ImfsFetcher>(
fn snapshot_project_node<F: VfsFetcher>(
context: &mut InstanceSnapshotContext,
instance_name: &str,
node: &ProjectNode,
imfs: &mut Imfs<F>,
vfs: &mut Vfs<F>,
) -> SnapshotInstanceResult<'static> {
let name = Cow::Owned(instance_name.to_owned());
let mut class_name = node
@@ -92,9 +92,9 @@ fn snapshot_project_node<F: ImfsFetcher>(
let mut metadata = InstanceMetadata::default();
if let Some(path) = &node.path {
let entry = imfs.get(path)?;
let entry = vfs.get(path)?;
if let Some(snapshot) = snapshot_from_imfs(context, imfs, &entry)? {
if let Some(snapshot) = snapshot_from_vfs(context, vfs, &entry)? {
// If a class name was already specified, then it'll override the
// class name of this snapshot ONLY if it's a Folder.
//
@@ -144,7 +144,7 @@ fn snapshot_project_node<F: ImfsFetcher>(
.expect("$className or $path must be specified");
for (child_name, child_project_node) in &node.children {
if let Some(child) = snapshot_project_node(context, child_name, child_project_node, imfs)? {
if let Some(child) = snapshot_project_node(context, child_name, child_project_node, vfs)? {
children.push(child);
}
}
@@ -192,15 +192,15 @@ mod test {
use insta::assert_yaml_snapshot;
use maplit::hashmap;
use crate::imfs::{ImfsDebug, ImfsSnapshot, NoopFetcher};
use crate::vfs::{NoopFetcher, VfsDebug, VfsSnapshot};
#[test]
fn project_from_folder() {
let _ = env_logger::try_init();
let mut imfs = Imfs::new(NoopFetcher);
let dir = ImfsSnapshot::dir(hashmap! {
"default.project.json" => ImfsSnapshot::file(r#"
let mut vfs = Vfs::new(NoopFetcher);
let dir = VfsSnapshot::dir(hashmap! {
"default.project.json" => VfsSnapshot::file(r#"
{
"name": "indirect-project",
"tree": {
@@ -210,11 +210,11 @@ mod test {
"#),
});
imfs.debug_load_snapshot("/foo", dir);
vfs.debug_load_snapshot("/foo", dir);
let entry = imfs.get("/foo").unwrap();
let entry = vfs.get("/foo").unwrap();
let instance_snapshot =
SnapshotProject::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotProject::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.expect("snapshot error")
.expect("snapshot returned no instances");
@@ -225,9 +225,9 @@ mod test {
fn project_from_direct_file() {
let _ = env_logger::try_init();
let mut imfs = Imfs::new(NoopFetcher);
let dir = ImfsSnapshot::dir(hashmap! {
"hello.project.json" => ImfsSnapshot::file(r#"
let mut vfs = Vfs::new(NoopFetcher);
let dir = VfsSnapshot::dir(hashmap! {
"hello.project.json" => VfsSnapshot::file(r#"
{
"name": "direct-project",
"tree": {
@@ -237,11 +237,11 @@ mod test {
"#),
});
imfs.debug_load_snapshot("/foo", dir);
vfs.debug_load_snapshot("/foo", dir);
let entry = imfs.get("/foo/hello.project.json").unwrap();
let entry = vfs.get("/foo/hello.project.json").unwrap();
let instance_snapshot =
SnapshotProject::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotProject::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.expect("snapshot error")
.expect("snapshot returned no instances");
@@ -252,9 +252,9 @@ mod test {
fn project_with_resolved_properties() {
let _ = env_logger::try_init();
let mut imfs = Imfs::new(NoopFetcher);
let dir = ImfsSnapshot::dir(hashmap! {
"default.project.json" => ImfsSnapshot::file(r#"
let mut vfs = Vfs::new(NoopFetcher);
let dir = VfsSnapshot::dir(hashmap! {
"default.project.json" => VfsSnapshot::file(r#"
{
"name": "resolved-properties",
"tree": {
@@ -270,11 +270,11 @@ mod test {
"#),
});
imfs.debug_load_snapshot("/foo", dir);
vfs.debug_load_snapshot("/foo", dir);
let entry = imfs.get("/foo").unwrap();
let entry = vfs.get("/foo").unwrap();
let instance_snapshot =
SnapshotProject::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotProject::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.expect("snapshot error")
.expect("snapshot returned no instances");
@@ -285,9 +285,9 @@ mod test {
fn project_with_unresolved_properties() {
let _ = env_logger::try_init();
let mut imfs = Imfs::new(NoopFetcher);
let dir = ImfsSnapshot::dir(hashmap! {
"default.project.json" => ImfsSnapshot::file(r#"
let mut vfs = Vfs::new(NoopFetcher);
let dir = VfsSnapshot::dir(hashmap! {
"default.project.json" => VfsSnapshot::file(r#"
{
"name": "unresolved-properties",
"tree": {
@@ -300,11 +300,11 @@ mod test {
"#),
});
imfs.debug_load_snapshot("/foo", dir);
vfs.debug_load_snapshot("/foo", dir);
let entry = imfs.get("/foo").unwrap();
let entry = vfs.get("/foo").unwrap();
let instance_snapshot =
SnapshotProject::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotProject::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.expect("snapshot error")
.expect("snapshot returned no instances");
@@ -315,9 +315,9 @@ mod test {
fn project_with_children() {
let _ = env_logger::try_init();
let mut imfs = Imfs::new(NoopFetcher);
let dir = ImfsSnapshot::dir(hashmap! {
"default.project.json" => ImfsSnapshot::file(r#"
let mut vfs = Vfs::new(NoopFetcher);
let dir = VfsSnapshot::dir(hashmap! {
"default.project.json" => VfsSnapshot::file(r#"
{
"name": "children",
"tree": {
@@ -331,11 +331,11 @@ mod test {
"#),
});
imfs.debug_load_snapshot("/foo", dir);
vfs.debug_load_snapshot("/foo", dir);
let entry = imfs.get("/foo").unwrap();
let entry = vfs.get("/foo").unwrap();
let instance_snapshot =
SnapshotProject::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotProject::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.expect("snapshot error")
.expect("snapshot returned no instances");
@@ -346,9 +346,9 @@ mod test {
fn project_with_path_to_txt() {
let _ = env_logger::try_init();
let mut imfs = Imfs::new(NoopFetcher);
let dir = ImfsSnapshot::dir(hashmap! {
"default.project.json" => ImfsSnapshot::file(r#"
let mut vfs = Vfs::new(NoopFetcher);
let dir = VfsSnapshot::dir(hashmap! {
"default.project.json" => VfsSnapshot::file(r#"
{
"name": "path-project",
"tree": {
@@ -356,14 +356,14 @@ mod test {
}
}
"#),
"other.txt" => ImfsSnapshot::file("Hello, world!"),
"other.txt" => VfsSnapshot::file("Hello, world!"),
});
imfs.debug_load_snapshot("/foo", dir);
vfs.debug_load_snapshot("/foo", dir);
let entry = imfs.get("/foo").unwrap();
let entry = vfs.get("/foo").unwrap();
let instance_snapshot =
SnapshotProject::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotProject::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.expect("snapshot error")
.expect("snapshot returned no instances");
@@ -374,9 +374,9 @@ mod test {
fn project_with_path_to_project() {
let _ = env_logger::try_init();
let mut imfs = Imfs::new(NoopFetcher);
let dir = ImfsSnapshot::dir(hashmap! {
"default.project.json" => ImfsSnapshot::file(r#"
let mut vfs = Vfs::new(NoopFetcher);
let dir = VfsSnapshot::dir(hashmap! {
"default.project.json" => VfsSnapshot::file(r#"
{
"name": "path-project",
"tree": {
@@ -384,7 +384,7 @@ mod test {
}
}
"#),
"other.project.json" => ImfsSnapshot::file(r#"
"other.project.json" => VfsSnapshot::file(r#"
{
"name": "other-project",
"tree": {
@@ -394,11 +394,11 @@ mod test {
"#),
});
imfs.debug_load_snapshot("/foo", dir);
vfs.debug_load_snapshot("/foo", dir);
let entry = imfs.get("/foo").unwrap();
let entry = vfs.get("/foo").unwrap();
let instance_snapshot =
SnapshotProject::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotProject::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.expect("snapshot error")
.expect("snapshot returned no instances");
@@ -409,9 +409,9 @@ mod test {
fn project_with_path_to_project_with_children() {
let _ = env_logger::try_init();
let mut imfs = Imfs::new(NoopFetcher);
let dir = ImfsSnapshot::dir(hashmap! {
"default.project.json" => ImfsSnapshot::file(r#"
let mut vfs = Vfs::new(NoopFetcher);
let dir = VfsSnapshot::dir(hashmap! {
"default.project.json" => VfsSnapshot::file(r#"
{
"name": "path-child-project",
"tree": {
@@ -419,7 +419,7 @@ mod test {
}
}
"#),
"other.project.json" => ImfsSnapshot::file(r#"
"other.project.json" => VfsSnapshot::file(r#"
{
"name": "other-project",
"tree": {
@@ -433,11 +433,11 @@ mod test {
"#),
});
imfs.debug_load_snapshot("/foo", dir);
vfs.debug_load_snapshot("/foo", dir);
let entry = imfs.get("/foo").unwrap();
let entry = vfs.get("/foo").unwrap();
let instance_snapshot =
SnapshotProject::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotProject::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.expect("snapshot error")
.expect("snapshot returned no instances");
@@ -451,9 +451,9 @@ mod test {
fn project_path_property_overrides() {
let _ = env_logger::try_init();
let mut imfs = Imfs::new(NoopFetcher);
let dir = ImfsSnapshot::dir(hashmap! {
"default.project.json" => ImfsSnapshot::file(r#"
let mut vfs = Vfs::new(NoopFetcher);
let dir = VfsSnapshot::dir(hashmap! {
"default.project.json" => VfsSnapshot::file(r#"
{
"name": "path-property-override",
"tree": {
@@ -464,7 +464,7 @@ mod test {
}
}
"#),
"other.project.json" => ImfsSnapshot::file(r#"
"other.project.json" => VfsSnapshot::file(r#"
{
"name": "other-project",
"tree": {
@@ -477,11 +477,11 @@ mod test {
"#),
});
imfs.debug_load_snapshot("/foo", dir);
vfs.debug_load_snapshot("/foo", dir);
let entry = imfs.get("/foo").unwrap();
let entry = vfs.get("/foo").unwrap();
let instance_snapshot =
SnapshotProject::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotProject::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.expect("snapshot error")
.expect("snapshot returned no instances");

View File

@@ -1,8 +1,8 @@
use std::borrow::Cow;
use crate::{
imfs::{Imfs, ImfsEntry, ImfsFetcher},
snapshot::InstanceSnapshot,
vfs::{Vfs, VfsEntry, VfsFetcher},
};
use super::{
@@ -14,10 +14,10 @@ use super::{
pub struct SnapshotRbxlx;
impl SnapshotMiddleware for SnapshotRbxlx {
fn from_imfs<F: ImfsFetcher>(
fn from_vfs<F: VfsFetcher>(
_context: &mut InstanceSnapshotContext,
imfs: &mut Imfs<F>,
entry: &ImfsEntry,
vfs: &mut Vfs<F>,
entry: &VfsEntry,
) -> SnapshotInstanceResult<'static> {
if entry.is_directory() {
return Ok(None);
@@ -31,7 +31,7 @@ impl SnapshotMiddleware for SnapshotRbxlx {
let options = rbx_xml::DecodeOptions::new()
.property_behavior(rbx_xml::DecodePropertyBehavior::ReadUnknown);
let temp_tree = rbx_xml::from_reader(entry.contents(imfs)?, options)
let temp_tree = rbx_xml::from_reader(entry.contents(vfs)?, options)
.expect("TODO: Handle rbx_xml errors");
let root_id = temp_tree.get_root_id();

View File

@@ -3,8 +3,8 @@ use std::{borrow::Cow, collections::HashMap};
use rbx_dom_weak::{RbxInstanceProperties, RbxTree};
use crate::{
imfs::{Imfs, ImfsEntry, ImfsFetcher},
snapshot::InstanceSnapshot,
vfs::{Vfs, VfsEntry, VfsFetcher},
};
use super::{
@@ -16,10 +16,10 @@ use super::{
pub struct SnapshotRbxm;
impl SnapshotMiddleware for SnapshotRbxm {
fn from_imfs<F: ImfsFetcher>(
fn from_vfs<F: VfsFetcher>(
_context: &mut InstanceSnapshotContext,
imfs: &mut Imfs<F>,
entry: &ImfsEntry,
vfs: &mut Vfs<F>,
entry: &VfsEntry,
) -> SnapshotInstanceResult<'static> {
if entry.is_directory() {
return Ok(None);
@@ -37,7 +37,7 @@ impl SnapshotMiddleware for SnapshotRbxm {
});
let root_id = temp_tree.get_root_id();
rbx_binary::decode(&mut temp_tree, root_id, entry.contents(imfs)?)
rbx_binary::decode(&mut temp_tree, root_id, entry.contents(vfs)?)
.expect("TODO: Handle rbx_binary errors");
let root_instance = temp_tree.get_instance(root_id).unwrap();
@@ -60,18 +60,18 @@ impl SnapshotMiddleware for SnapshotRbxm {
mod test {
use super::*;
use crate::imfs::{ImfsDebug, ImfsSnapshot, NoopFetcher};
use crate::vfs::{NoopFetcher, VfsDebug, VfsSnapshot};
#[test]
fn model_from_imfs() {
let mut imfs = Imfs::new(NoopFetcher);
let file = ImfsSnapshot::file(include_bytes!("../../assets/test-folder.rbxm").to_vec());
fn model_from_vfs() {
let mut vfs = Vfs::new(NoopFetcher);
let file = VfsSnapshot::file(include_bytes!("../../assets/test-folder.rbxm").to_vec());
imfs.debug_load_snapshot("/foo.rbxm", file);
vfs.debug_load_snapshot("/foo.rbxm", file);
let entry = imfs.get("/foo.rbxm").unwrap();
let entry = vfs.get("/foo.rbxm").unwrap();
let instance_snapshot =
SnapshotRbxm::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotRbxm::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.unwrap()
.unwrap();

View File

@@ -1,8 +1,8 @@
use std::borrow::Cow;
use crate::{
imfs::{Imfs, ImfsEntry, ImfsFetcher},
snapshot::InstanceSnapshot,
vfs::{Vfs, VfsEntry, VfsFetcher},
};
use super::{
@@ -14,10 +14,10 @@ use super::{
pub struct SnapshotRbxmx;
impl SnapshotMiddleware for SnapshotRbxmx {
fn from_imfs<F: ImfsFetcher>(
fn from_vfs<F: VfsFetcher>(
_context: &mut InstanceSnapshotContext,
imfs: &mut Imfs<F>,
entry: &ImfsEntry,
vfs: &mut Vfs<F>,
entry: &VfsEntry,
) -> SnapshotInstanceResult<'static> {
if entry.is_directory() {
return Ok(None);
@@ -31,7 +31,7 @@ impl SnapshotMiddleware for SnapshotRbxmx {
let options = rbx_xml::DecodeOptions::new()
.property_behavior(rbx_xml::DecodePropertyBehavior::ReadUnknown);
let temp_tree = rbx_xml::from_reader(entry.contents(imfs)?, options)
let temp_tree = rbx_xml::from_reader(entry.contents(vfs)?, options)
.expect("TODO: Handle rbx_xml errors");
let root_instance = temp_tree.get_instance(temp_tree.get_root_id()).unwrap();
@@ -56,12 +56,12 @@ mod test {
use std::collections::HashMap;
use crate::imfs::{ImfsDebug, ImfsSnapshot, NoopFetcher};
use crate::vfs::{NoopFetcher, VfsDebug, VfsSnapshot};
#[test]
fn model_from_imfs() {
let mut imfs = Imfs::new(NoopFetcher);
let file = ImfsSnapshot::file(
fn model_from_vfs() {
let mut vfs = Vfs::new(NoopFetcher);
let file = VfsSnapshot::file(
r#"
<roblox version="4">
<Item class="Folder" referent="0">
@@ -73,11 +73,11 @@ mod test {
"#,
);
imfs.debug_load_snapshot("/foo.rbxmx", file);
vfs.debug_load_snapshot("/foo.rbxmx", file);
let entry = imfs.get("/foo.rbxmx").unwrap();
let entry = vfs.get("/foo.rbxmx").unwrap();
let instance_snapshot =
SnapshotRbxmx::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotRbxmx::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.unwrap()
.unwrap();

View File

@@ -4,8 +4,8 @@ use maplit::hashmap;
use rbx_dom_weak::{RbxId, RbxTree, RbxValue};
use crate::{
imfs::{FileSnapshot, FsResultExt, Imfs, ImfsEntry, ImfsFetcher, ImfsSnapshot},
snapshot::{InstanceMetadata, InstanceSnapshot},
vfs::{FileSnapshot, FsResultExt, Vfs, VfsEntry, VfsFetcher, VfsSnapshot},
};
use super::{
@@ -19,10 +19,10 @@ use super::{
pub struct SnapshotTxt;
impl SnapshotMiddleware for SnapshotTxt {
fn from_imfs<F: ImfsFetcher>(
fn from_vfs<F: VfsFetcher>(
_context: &mut InstanceSnapshotContext,
imfs: &mut Imfs<F>,
entry: &ImfsEntry,
vfs: &mut Vfs<F>,
entry: &VfsEntry,
) -> SnapshotInstanceResult<'static> {
if entry.is_directory() {
return Ok(None);
@@ -33,7 +33,7 @@ impl SnapshotMiddleware for SnapshotTxt {
None => return Ok(None),
};
let contents = entry.contents(imfs)?;
let contents = entry.contents(vfs)?;
let contents_str = str::from_utf8(contents)
.map_err(|err| SnapshotError::file_contents_bad_unicode(err, entry.path()))?
.to_string();
@@ -61,8 +61,8 @@ impl SnapshotMiddleware for SnapshotTxt {
children: Vec::new(),
};
if let Some(meta_entry) = imfs.get(meta_path).with_not_found()? {
let meta_contents = meta_entry.contents(imfs)?;
if let Some(meta_entry) = vfs.get(meta_path).with_not_found()? {
let meta_contents = meta_entry.contents(vfs)?;
let mut metadata = AdjacentMetadata::from_slice(meta_contents);
metadata.apply_all(&mut snapshot);
}
@@ -87,7 +87,7 @@ impl SnapshotMiddleware for SnapshotTxt {
None => String::new(),
};
let snapshot = ImfsSnapshot::File(FileSnapshot {
let snapshot = VfsSnapshot::File(FileSnapshot {
contents: value.into_bytes(),
});
@@ -106,18 +106,18 @@ mod test {
use maplit::hashmap;
use rbx_dom_weak::RbxInstanceProperties;
use crate::imfs::{ImfsDebug, NoopFetcher};
use crate::vfs::{NoopFetcher, VfsDebug};
#[test]
fn instance_from_imfs() {
let mut imfs = Imfs::new(NoopFetcher);
let file = ImfsSnapshot::file("Hello there!");
fn instance_from_vfs() {
let mut vfs = Vfs::new(NoopFetcher);
let file = VfsSnapshot::file("Hello there!");
imfs.debug_load_snapshot("/foo.txt", file);
vfs.debug_load_snapshot("/foo.txt", file);
let entry = imfs.get("/foo.txt").unwrap();
let entry = vfs.get("/foo.txt").unwrap();
let instance_snapshot =
SnapshotTxt::from_imfs(&mut InstanceSnapshotContext::default(), &mut imfs, &entry)
SnapshotTxt::from_vfs(&mut InstanceSnapshotContext::default(), &mut vfs, &entry)
.unwrap()
.unwrap();
@@ -125,7 +125,7 @@ mod test {
}
#[test]
fn imfs_from_instance() {
fn vfs_from_instance() {
let tree = RbxTree::new(string_value("Root", "Hello, world!"));
let root_id = tree.get_root_id();

View File

@@ -2,7 +2,7 @@ use std::{fs, path::Path};
use rlua::{Lua, RegistryKey};
use crate::imfs::{Imfs, ImfsEntry, ImfsFetcher};
use crate::vfs::{Vfs, VfsEntry, VfsFetcher};
use super::{
context::InstanceSnapshotContext,
@@ -19,10 +19,10 @@ use super::{
pub struct SnapshotUserPlugins;
impl SnapshotMiddleware for SnapshotUserPlugins {
fn from_imfs<F: ImfsFetcher>(
fn from_vfs<F: VfsFetcher>(
context: &mut InstanceSnapshotContext,
_imfs: &mut Imfs<F>,
_entry: &ImfsEntry,
_vfs: &mut Vfs<F>,
_entry: &VfsEntry,
) -> SnapshotInstanceResult<'static> {
// User plugins are only enabled if present on the snapshot context.
let plugin_context = match &mut context.plugin_context {
@@ -52,7 +52,7 @@ impl SnapshotMiddleware for SnapshotUserPlugins {
// The current plan for plugins here is to make them work
// like Redux/Rodux middleware. A plugin will be a function
// that accepts the next middleware in the chain as a
// function and the snapshot subject (the IMFS entry).
// function and the snapshot subject (the VFS entry).
//
// Plugins can (but don't have to) invoke the next snapshot
// function and may or may not mutate the result. The hope
@@ -69,7 +69,7 @@ impl SnapshotMiddleware for SnapshotUserPlugins {
// * Will plugins hurt Rojo's ability to parallelize
// snapshotting in the future?
//
// * Do the mutable handles to the Imfs and the snapshot
// * Do the mutable handles to the Vfs and the snapshot
// context prevent plugins from invoking other plugins
// indirectly?
//