mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-22 21:55:15 +00:00
Introduce InstanceContext (#270)
* Add instance context with dummy field * Remove stub field
This commit is contained in:
committed by
GitHub
parent
a48c238ed7
commit
12df80da56
@@ -43,6 +43,14 @@ pub struct InstanceMetadata {
|
||||
// TODO: Change this to be a SmallVec for performance in common cases?
|
||||
#[serde(serialize_with = "path_serializer::serialize_vec_absolute")]
|
||||
pub relevant_paths: Vec<PathBuf>,
|
||||
|
||||
/// Contains information about this instance that should persist between
|
||||
/// snapshot invocations and is generally inherited.
|
||||
///
|
||||
/// If an instance has a piece of context attached to it, then the next time
|
||||
/// that instance's instigating source is snapshotted directly, the same
|
||||
/// context will be passed into it.
|
||||
pub context: InstanceContext,
|
||||
}
|
||||
|
||||
impl InstanceMetadata {
|
||||
@@ -51,6 +59,7 @@ impl InstanceMetadata {
|
||||
ignore_unknown_instances: false,
|
||||
instigating_source: None,
|
||||
relevant_paths: Vec::new(),
|
||||
context: InstanceContext::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +83,13 @@ impl InstanceMetadata {
|
||||
..self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn context(self, context: &InstanceContext) -> Self {
|
||||
Self {
|
||||
context: context.clone(),
|
||||
..self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for InstanceMetadata {
|
||||
@@ -82,6 +98,15 @@ impl Default for InstanceMetadata {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct InstanceContext {}
|
||||
|
||||
impl Default for InstanceContext {
|
||||
fn default() -> Self {
|
||||
InstanceContext {}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub enum InstigatingSource {
|
||||
Path(#[serde(serialize_with = "path_serializer::serialize_absolute")] PathBuf),
|
||||
|
||||
Reference in New Issue
Block a user