forked from rojo-rbx/rojo
added attributes to AdjacentMetadata (#624)
* added attributes to AdjacentMetadata * ran fmt
This commit is contained in:
@@ -19,6 +19,9 @@ pub struct AdjacentMetadata {
|
||||
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
|
||||
pub properties: HashMap<String, UnresolvedValue>,
|
||||
|
||||
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
|
||||
pub attributes: HashMap<String, UnresolvedValue>,
|
||||
|
||||
#[serde(skip)]
|
||||
pub path: PathBuf,
|
||||
}
|
||||
@@ -53,6 +56,19 @@ impl AdjacentMetadata {
|
||||
snapshot.properties.insert(key, value);
|
||||
}
|
||||
|
||||
if !self.attributes.is_empty() {
|
||||
let mut attributes = Attributes::new();
|
||||
|
||||
for (key, unresolved) in self.attributes.drain() {
|
||||
let value = unresolved.resolve_unambiguous()?;
|
||||
attributes.insert(key, value);
|
||||
}
|
||||
|
||||
snapshot
|
||||
.properties
|
||||
.insert("Attributes".into(), attributes.into());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user