mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-20 12:45:05 +00:00
Support nested partitions and partitions directly targeting services (#122)
* Do the nested partition thing * Tidy up touched code * Add nested partition test project, not fully functional * Clean up variable names, move path_metadata mutation strictly into snapshot_reconciler * Remove path_metadata, snapshotting is now pure * Factor out snapshot metadata storage to fix a missing case * Pull instance_name out of per_path_metadata, closer to what we need * Refactor to make metadata make more sense, part one * All appears to be well * Cull 'metadata_per_path' in favor of 'instances_per_path' * Remove SnapshotContext * InstanceMetadata -> PublicInstanceMetadata in web module * Build in snapshot testing system for testing... snapshots? * Remove pretty_assertions to see if it fixes a snapshot comparison bug * Reintroduce pretty assertions, it's not the cause of inequality * Fix snapshot tests with custom relative path serializer
This commit is contained in:
committed by
GitHub
parent
38e3c198f2
commit
ecb9b5e28f
@@ -1,5 +1,4 @@
|
||||
use std::{
|
||||
collections::hash_map,
|
||||
path::{self, Path, PathBuf},
|
||||
collections::{HashMap, HashSet},
|
||||
};
|
||||
@@ -36,12 +35,6 @@ impl<T> PathMap<T> {
|
||||
self.nodes.get_mut(path).map(|v| &mut v.value)
|
||||
}
|
||||
|
||||
pub fn entry<'a>(&'a mut self, path: PathBuf) -> Entry<'a, T> {
|
||||
Entry {
|
||||
internal: self.nodes.entry(path),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, path: PathBuf, value: T) {
|
||||
if let Some(parent_path) = path.parent() {
|
||||
if let Some(parent) = self.nodes.get_mut(parent_path) {
|
||||
@@ -116,28 +109,4 @@ impl<T> PathMap<T> {
|
||||
|
||||
current_path
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Entry<'a, T> {
|
||||
internal: hash_map::Entry<'a, PathBuf, PathMapNode<T>>,
|
||||
}
|
||||
|
||||
impl<'a, T> Entry<'a, T> {
|
||||
pub fn or_insert(self, value: T) -> &'a mut T {
|
||||
&mut self.internal.or_insert(PathMapNode {
|
||||
value,
|
||||
children: HashSet::new(),
|
||||
}).value
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T> Entry<'a, T>
|
||||
where T: Default
|
||||
{
|
||||
pub fn or_default(self) -> &'a mut T {
|
||||
&mut self.internal.or_insert(PathMapNode {
|
||||
value: Default::default(),
|
||||
children: HashSet::new(),
|
||||
}).value
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user