Skip to main content

VitalFormat

Struct VitalFormat 

Source
pub struct VitalFormat { /* private fields */ }
Expand description

The .vital format.

A read parses the whole JSON tree. Peak memory depends on the shape of the file: a file of long base64 texts takes about 3 times its size, and a file of short numbers up to about 38 times. Measured in a release build: 60 MB of 0, items peaked at 2.28 GB, 60 MB in one text at 184 MB.

Implementations§

Source§

impl VitalFormat

Source

pub const fn new(max_bytes: usize) -> Self

A format whose reader refuses inputs larger than max_bytes.

Trait Implementations§

Source§

impl Debug for VitalFormat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PresetFormat for VitalFormat

Source§

fn synth(&self) -> Synth

The synth the format serves.
Source§

fn extension(&self) -> &'static str

The file extension without the dot.
Source§

fn max_bytes(&self) -> usize

The largest input PresetFormat::read accepts, in bytes.
Source§

fn read(&self, bytes: &[u8]) -> Result<Box<dyn PresetModel>, FormatError>

Decodes a preset. Read more
Source§

fn read_header(&self, bytes: &[u8]) -> Result<Header, FormatError>

Decodes only the header fields, without the large parts. Read more
Source§

fn write(&self, model: &dyn PresetModel) -> Result<Vec<u8>, FormatError>

Encodes a model of this synth. Read more
Source§

fn absent_means_default(&self, _key: &str) -> bool

Whether a missing key and an explicit default sound the same.
Source§

fn template(&self) -> &dyn TemplateSource

Where the template of this synth comes from.
Source§

fn route_sources(&self) -> &'static [&'static str]

The names a modulation source may take.
Source§

fn default_polarity(&self, source: &str) -> RoutePolarity

The polarity of a route whose edit names none.
Source§

fn check_value(&self, _key: &str, _stored: f64) -> Result<(), FormatError>

Checks a stored value that the registry range allows but the writer cannot write yet. Read more
Source§

fn scan( &self, model: &dyn PresetModel, edited: &[&str], ) -> Result<Vec<String>, FormatError>

Scans a model after an edit list: every control holds a value of the right wire type inside its range, and the structured parts are whole. Returns warnings, such as a route into a switched-off module. Read more
Source§

fn factory_folder(&self) -> &'static [&'static str]

The trailing folder names of the synth’s factory preset folder, outermost first, such as the data folder and then Factory. The writer refuses to write into it. Empty when the synth has none.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.