Files
vectorcraft/crates/doc/src/skip.rs
T
dotCooCoo 9992fa0bf6 Symbols: saving leaves out a nested editing layer and keeps layers named in file data
Leaving opacity-mask or symbol editing now removes the editing layer
wherever it is, so a save or export after Layers moved it into another
layer no longer writes it. An editing id that names anything other than
a layer is left alone.

symbol_edit is no longer read from files: a value in file data is
dropped on load, so the layer it names is kept and saving does not
write the value again.
2026-11-04 21:59:11 +07:00

21 lines
610 B
Rust

pub fn is_default<T: Default + PartialEq>(v: &T) -> bool {
*v == T::default()
}
pub fn is_true(v: &bool) -> bool {
*v
}
pub fn is_one(v: &f32) -> bool {
*v == 1.0
}
pub fn is_empty_vec<T>(v: &[T]) -> bool {
v.is_empty()
}
pub fn is_empty_map(v: &serde_json::Map<String, serde_json::Value>) -> bool {
v.is_empty()
}
/// Read a field's value and drop it, giving `None`: for state that is never taken from a file.
pub fn read_as_none<'de, D: serde::Deserializer<'de>, T>(d: D) -> Result<Option<T>, D::Error> {
<serde::de::IgnoredAny as serde::Deserialize>::deserialize(d)?;
Ok(None)
}