pub struct Meta {
pub version: u32,
pub markers: BTreeMap<String, f64>,
pub eases: BTreeMap<String, [f64; 4]>,
pub tunables: BTreeMap<String, f64>,
pub audio: Option<AudioMeta>,
pub extra: BTreeMap<String, Value>,
}Expand description
Contents of <scene>.meta.json.
The file is the source of truth for markers, eases and tunables; scene code only provides defaults. Unknown keys are preserved verbatim.
Fields§
§version: u32Schema version, META_SCHEMA_VERSION.
markers: BTreeMap<String, f64>Marker times in seconds from the start of the scene.
eases: BTreeMap<String, [f64; 4]>Named eases as [x1, y1, x2, y2].
tunables: BTreeMap<String, f64>Tunable values.
audio: Option<AudioMeta>Soundtrack placement.
extra: BTreeMap<String, Value>Keys this version does not know, kept as they are.
Implementations§
Source§impl Meta
impl Meta
Sourcepub fn parse(text: &str) -> Result<Self, MetaError>
pub fn parse(text: &str) -> Result<Self, MetaError>
Parses and validates a meta.json file.
§Errors
If the text is not valid JSON of this shape, has another schema version, or contains an invalid name.
Sourcepub fn validate(&self) -> Result<(), MetaError>
pub fn validate(&self) -> Result<(), MetaError>
Checks that all names are valid.
§Errors
MetaError::InvalidName for the first name that is not [a-z0-9_-]+.
Sourcepub fn to_pretty_string(&self) -> String
pub fn to_pretty_string(&self) -> String
Deterministic formatting: keys sorted at every level, two-space indent, trailing newline — so diffs in git stay readable.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Meta
impl<'de> Deserialize<'de> for Meta
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Meta
Auto Trait Implementations§
impl Freeze for Meta
impl RefUnwindSafe for Meta
impl Send for Meta
impl Sync for Meta
impl Unpin for Meta
impl UnsafeUnpin for Meta
impl UnwindSafe for Meta
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more