Skip to main content

EffectCache

Struct EffectCache 

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

Loads each effect once.

Implementations§

Source§

impl EffectCache

Source

pub fn get(&mut self, archive: &Archive, reference: &str) -> Option<Rc<Effect>>

An effect by its reference, loaded and decoded the first time it is asked for.

Source

pub fn preload(&mut self, archive: &Archive, references: &[&str])

Load every effect of references that is not loaded yet, as EffectCache::get would one by one.

Source

pub fn missing<'a>(&self, references: &[&'a str]) -> Vec<&'a str>

The effects of references that are not loaded yet.

Source

pub fn prepare(archive: &Archive, references: &[&str]) -> Prepared

Read and decode effects without the cache, so that it can run on another thread while the caller loads something else. Each sound buffer decodes on its own (a pure function of its data), so all the buffers of all the effects decode in parallel (native).

Source

pub fn add(&mut self, prepared: Prepared)

Put prepared effects in the cache (an effect already there is kept).

Trait Implementations§

Source§

impl Default for EffectCache

Source§

fn default() -> EffectCache

Returns the “default value” for a type. Read more

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

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.

§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.