forked from rojo-rbx/rojo
Remove lifetime from SnapshotInstanceResult
This commit is contained in:
@@ -23,7 +23,7 @@ impl SnapshotMiddleware for SnapshotCsv {
|
||||
_context: &mut InstanceSnapshotContext,
|
||||
vfs: &Vfs<F>,
|
||||
entry: &VfsEntry,
|
||||
) -> SnapshotInstanceResult<'static> {
|
||||
) -> SnapshotInstanceResult {
|
||||
if entry.is_directory() {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ impl SnapshotMiddleware for SnapshotDir {
|
||||
context: &mut InstanceSnapshotContext,
|
||||
vfs: &Vfs<F>,
|
||||
entry: &VfsEntry,
|
||||
) -> SnapshotInstanceResult<'static> {
|
||||
) -> SnapshotInstanceResult {
|
||||
if entry.is_file() {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ impl SnapshotMiddleware for SnapshotJsonModel {
|
||||
_context: &mut InstanceSnapshotContext,
|
||||
vfs: &Vfs<F>,
|
||||
entry: &VfsEntry,
|
||||
) -> SnapshotInstanceResult<'static> {
|
||||
) -> SnapshotInstanceResult {
|
||||
if entry.is_directory() {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ impl SnapshotMiddleware for SnapshotLua {
|
||||
context: &mut InstanceSnapshotContext,
|
||||
vfs: &Vfs<F>,
|
||||
entry: &VfsEntry,
|
||||
) -> SnapshotInstanceResult<'static> {
|
||||
) -> SnapshotInstanceResult {
|
||||
let file_name = entry.path().file_name().unwrap().to_string_lossy();
|
||||
|
||||
// These paths alter their parent instance, so we don't need to turn
|
||||
@@ -55,10 +55,7 @@ impl SnapshotMiddleware for SnapshotLua {
|
||||
}
|
||||
|
||||
/// Core routine for turning Lua files into snapshots.
|
||||
fn snapshot_lua_file<F: VfsFetcher>(
|
||||
vfs: &Vfs<F>,
|
||||
entry: &VfsEntry,
|
||||
) -> SnapshotInstanceResult<'static> {
|
||||
fn snapshot_lua_file<F: VfsFetcher>(vfs: &Vfs<F>, entry: &VfsEntry) -> SnapshotInstanceResult {
|
||||
let file_name = entry.path().file_name().unwrap().to_string_lossy();
|
||||
|
||||
let (class_name, instance_name) = if let Some(name) = match_trailing(&file_name, ".server.lua")
|
||||
@@ -122,7 +119,7 @@ fn snapshot_init<F: VfsFetcher>(
|
||||
vfs: &Vfs<F>,
|
||||
folder_entry: &VfsEntry,
|
||||
init_name: &str,
|
||||
) -> SnapshotInstanceResult<'static> {
|
||||
) -> SnapshotInstanceResult {
|
||||
let init_path = folder_entry.path().join(init_name);
|
||||
|
||||
if let Some(init_entry) = vfs.get(init_path).with_not_found()? {
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::{
|
||||
|
||||
use super::{context::InstanceSnapshotContext, error::SnapshotError};
|
||||
|
||||
pub type SnapshotInstanceResult<'a> = Result<Option<InstanceSnapshot>, SnapshotError>;
|
||||
pub type SnapshotInstanceResult = Result<Option<InstanceSnapshot>, SnapshotError>;
|
||||
pub type SnapshotFileResult = Option<(String, VfsSnapshot)>;
|
||||
|
||||
pub trait SnapshotMiddleware {
|
||||
@@ -15,7 +15,7 @@ pub trait SnapshotMiddleware {
|
||||
context: &mut InstanceSnapshotContext,
|
||||
vfs: &Vfs<F>,
|
||||
entry: &VfsEntry,
|
||||
) -> SnapshotInstanceResult<'static>;
|
||||
) -> SnapshotInstanceResult;
|
||||
|
||||
fn from_instance(_tree: &RbxTree, _id: RbxId) -> SnapshotFileResult {
|
||||
None
|
||||
|
||||
@@ -48,7 +48,7 @@ macro_rules! middlewares {
|
||||
context: &mut InstanceSnapshotContext,
|
||||
vfs: &Vfs<F>,
|
||||
entry: &VfsEntry,
|
||||
) -> SnapshotInstanceResult<'static> {
|
||||
) -> SnapshotInstanceResult {
|
||||
$(
|
||||
log::trace!("trying middleware {} on {}", stringify!($middleware), entry.path().display());
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ impl SnapshotMiddleware for SnapshotProject {
|
||||
context: &mut InstanceSnapshotContext,
|
||||
vfs: &Vfs<F>,
|
||||
entry: &VfsEntry,
|
||||
) -> SnapshotInstanceResult<'static> {
|
||||
) -> SnapshotInstanceResult {
|
||||
if entry.is_directory() {
|
||||
let project_path = entry.path().join("default.project.json");
|
||||
|
||||
@@ -81,7 +81,7 @@ pub fn snapshot_project_node<F: VfsFetcher>(
|
||||
instance_name: &str,
|
||||
node: &ProjectNode,
|
||||
vfs: &Vfs<F>,
|
||||
) -> SnapshotInstanceResult<'static> {
|
||||
) -> SnapshotInstanceResult {
|
||||
let name = Cow::Owned(instance_name.to_owned());
|
||||
let mut class_name = node
|
||||
.class_name
|
||||
|
||||
@@ -18,7 +18,7 @@ impl SnapshotMiddleware for SnapshotRbxlx {
|
||||
_context: &mut InstanceSnapshotContext,
|
||||
vfs: &Vfs<F>,
|
||||
entry: &VfsEntry,
|
||||
) -> SnapshotInstanceResult<'static> {
|
||||
) -> SnapshotInstanceResult {
|
||||
if entry.is_directory() {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ impl SnapshotMiddleware for SnapshotRbxm {
|
||||
_context: &mut InstanceSnapshotContext,
|
||||
vfs: &Vfs<F>,
|
||||
entry: &VfsEntry,
|
||||
) -> SnapshotInstanceResult<'static> {
|
||||
) -> SnapshotInstanceResult {
|
||||
if entry.is_directory() {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ impl SnapshotMiddleware for SnapshotRbxmx {
|
||||
_context: &mut InstanceSnapshotContext,
|
||||
vfs: &Vfs<F>,
|
||||
entry: &VfsEntry,
|
||||
) -> SnapshotInstanceResult<'static> {
|
||||
) -> SnapshotInstanceResult {
|
||||
if entry.is_directory() {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ impl SnapshotMiddleware for SnapshotTxt {
|
||||
_context: &mut InstanceSnapshotContext,
|
||||
vfs: &Vfs<F>,
|
||||
entry: &VfsEntry,
|
||||
) -> SnapshotInstanceResult<'static> {
|
||||
) -> SnapshotInstanceResult {
|
||||
if entry.is_directory() {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ impl SnapshotMiddleware for SnapshotUserPlugins {
|
||||
context: &mut InstanceSnapshotContext,
|
||||
_vfs: &Vfs<F>,
|
||||
_entry: &VfsEntry,
|
||||
) -> SnapshotInstanceResult<'static> {
|
||||
) -> SnapshotInstanceResult {
|
||||
// User plugins are only enabled if present on the snapshot context.
|
||||
let plugin_context = match &mut context.plugin_context {
|
||||
Some(ctx) => ctx,
|
||||
|
||||
Reference in New Issue
Block a user