pub struct Patch {
pub doc: SoundDoc,
pub params: Vec<ParamSpec>,
}Expand description
A SoundDoc template plus its parameters. Ships as JSON; loaded and rendered
at runtime with per-instance values.
Fields§
§doc: SoundDocThe template document.
params: Vec<ParamSpec>The parameters that vary it.
Implementations§
Source§impl Patch
impl Patch
Sourcepub fn new(doc: SoundDoc) -> Self
pub fn new(doc: SoundDoc) -> Self
A patch around doc with no parameters yet — add ParamSpecs to
expose knobs.
Sourcepub fn instantiate(
&self,
values: &BTreeMap<String, f32>,
) -> Result<SoundDoc, EditError>
pub fn instantiate( &self, values: &BTreeMap<String, f32>, ) -> Result<SoundDoc, EditError>
Bake the patch into a concrete document with the given parameter values (missing → default, out-of-range → clamped). Validated like any edit, so a bad path or value is a clear error, never a corrupt graph.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Patch
impl<'de> Deserialize<'de> for Patch
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
Source§impl JsonSchema for Patch
impl JsonSchema for Patch
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for Patch
impl RefUnwindSafe for Patch
impl Send for Patch
impl Sync for Patch
impl Unpin for Patch
impl UnsafeUnpin for Patch
impl UnwindSafe for Patch
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