Skip to main content

PresetModel

Trait PresetModel 

Source
pub trait PresetModel:
    Debug
    + Send
    + Sync {
Show 13 methods // Required methods fn header(&self) -> Header; fn get(&self, key: &str) -> Option<Stored>; fn set(&mut self, key: &str, value: Stored) -> Result<(), FormatError>; fn reset(&mut self, key: &str); fn routes(&self) -> Vec<Option<Route>>; fn set_route( &mut self, slot: usize, route: Option<Route>, ) -> Result<(), FormatError>; fn set_name(&mut self, name: &str) -> Result<(), FormatError>; fn set_author(&mut self, author: &str) -> Result<(), FormatError>; fn set_description(&mut self, description: &str) -> Result<(), FormatError>; fn set_tags(&mut self, tags: &[String]) -> Result<(), FormatError>; fn describe(&self, opts: &DescribeOptions) -> Description; fn unknown_keys(&self) -> Vec<String>; fn as_any(&self) -> &dyn Any;
}
Expand description

A decoded preset.

Required Methods§

Source

fn header(&self) -> Header

The header fields.

Source

fn get(&self, key: &str) -> Option<Stored>

The value of a control as the file holds it, or None when the key is absent. An explicit default is Some.

Source

fn set(&mut self, key: &str, value: Stored) -> Result<(), FormatError>

Sets a control.

§Errors

A FormatError when the format cannot hold the value there. The model is unchanged then.

Source

fn reset(&mut self, key: &str)

Removes a control, or writes its default where the format needs one.

Source

fn routes(&self) -> Vec<Option<Route>>

The modulation slots in order. An empty slot is None.

Source

fn set_route( &mut self, slot: usize, route: Option<Route>, ) -> Result<(), FormatError>

Sets or clears a modulation slot.

§Errors

A FormatError when the slot does not exist or the route does not fit the format. The model is unchanged then.

Source

fn set_name(&mut self, name: &str) -> Result<(), FormatError>

Sets the preset name.

§Errors

A FormatError when the format cannot hold the text.

Source

fn set_author(&mut self, author: &str) -> Result<(), FormatError>

Sets the author.

§Errors

A FormatError when the format cannot hold the text.

Source

fn set_description(&mut self, description: &str) -> Result<(), FormatError>

Sets the description.

§Errors

A FormatError when the format cannot hold the text.

Source

fn set_tags(&mut self, tags: &[String]) -> Result<(), FormatError>

Sets the tags or the style.

§Errors

A FormatError naming the tags the format accepts.

Source

fn describe(&self, opts: &DescribeOptions) -> Description

The ordered tree that preset inspect prints.

Source

fn unknown_keys(&self) -> Vec<String>

Keys in the file that the registry does not cover, as paths such as settings.custom_warps. They stay in the model and survive a write.

Source

fn as_any(&self) -> &dyn Any

The model as Any, so its format can take it back for writing.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§