mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-23 14:15:24 +00:00
Make all file contents be Arc<Vec<u8>> instead of &[u8]
This commit is contained in:
@@ -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(vfs)?);
|
||||
let table_contents = convert_localization_csv(&entry.contents(vfs)?);
|
||||
|
||||
let mut snapshot = InstanceSnapshot {
|
||||
snapshot_id: None,
|
||||
@@ -58,7 +58,7 @@ impl SnapshotMiddleware for SnapshotCsv {
|
||||
|
||||
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);
|
||||
let mut metadata = AdjacentMetadata::from_slice(&meta_contents);
|
||||
metadata.apply_all(&mut snapshot);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ impl SnapshotMiddleware for SnapshotJsonModel {
|
||||
};
|
||||
|
||||
let instance: JsonModel =
|
||||
serde_json::from_slice(entry.contents(vfs)?).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 {
|
||||
|
||||
@@ -71,7 +71,7 @@ fn snapshot_lua_file<F: VfsFetcher>(
|
||||
};
|
||||
|
||||
let contents = entry.contents(vfs)?;
|
||||
let contents_str = str::from_utf8(contents)
|
||||
let contents_str = str::from_utf8(&contents)
|
||||
// TODO: Turn into error type
|
||||
.expect("File content was not valid UTF-8")
|
||||
.to_string();
|
||||
@@ -103,7 +103,7 @@ fn snapshot_lua_file<F: VfsFetcher>(
|
||||
|
||||
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);
|
||||
let mut metadata = AdjacentMetadata::from_slice(&meta_contents);
|
||||
metadata.apply_all(&mut snapshot);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ impl SnapshotMiddleware for SnapshotProject {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
let project = Project::load_from_slice(entry.contents(vfs)?, 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
|
||||
|
||||
@@ -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(vfs)?, options)
|
||||
let temp_tree = rbx_xml::from_reader(entry.contents(vfs)?.as_slice(), options)
|
||||
.expect("TODO: Handle rbx_xml errors");
|
||||
|
||||
let root_id = temp_tree.get_root_id();
|
||||
|
||||
@@ -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(vfs)?)
|
||||
rbx_binary::decode(&mut temp_tree, root_id, entry.contents(vfs)?.as_slice())
|
||||
.expect("TODO: Handle rbx_binary errors");
|
||||
|
||||
let root_instance = temp_tree.get_instance(root_id).unwrap();
|
||||
|
||||
@@ -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(vfs)?, options)
|
||||
let temp_tree = rbx_xml::from_reader(entry.contents(vfs)?.as_slice(), options)
|
||||
.expect("TODO: Handle rbx_xml errors");
|
||||
|
||||
let root_instance = temp_tree.get_instance(temp_tree.get_root_id()).unwrap();
|
||||
|
||||
@@ -34,7 +34,7 @@ impl SnapshotMiddleware for SnapshotTxt {
|
||||
};
|
||||
|
||||
let contents = entry.contents(vfs)?;
|
||||
let contents_str = str::from_utf8(contents)
|
||||
let contents_str = str::from_utf8(&contents)
|
||||
.map_err(|err| SnapshotError::file_contents_bad_unicode(err, entry.path()))?
|
||||
.to_string();
|
||||
|
||||
@@ -63,7 +63,7 @@ impl SnapshotMiddleware for SnapshotTxt {
|
||||
|
||||
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);
|
||||
let mut metadata = AdjacentMetadata::from_slice(&meta_contents);
|
||||
metadata.apply_all(&mut snapshot);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user