pub struct Loader { /* private fields */ }Expand description
One background worker with a bounded request queue and a private AudioCache.
Submission never waits for queue space, but may allocate/free memory and uses std channels. All methods, polling and destruction belong off the audio thread. Dropping the loader closes its queue and waits for accepted requests to finish; their handles remain usable. A dropped handle does not cancel its decode/cache admission. No async runtime or mixer feature is required.
Implementations§
Source§impl Loader
impl Loader
Sourcepub fn new(config: LoaderConfig) -> Result<Self>
pub fn new(config: LoaderConfig) -> Result<Self>
Spawn the worker. Thread creation failures return Io.
Sourcepub fn load_bytes(
&self,
name: impl Into<String>,
bytes: Vec<u8>,
) -> Result<LoadHandle>
pub fn load_bytes( &self, name: impl Into<String>, bytes: Vec<u8>, ) -> Result<LoadHandle>
Queue owned encoded bytes under a name. Reusing a cached name returns its original sound. Input size is checked even on cache hits; bytes are not copied.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Loader
impl !UnwindSafe for Loader
impl Freeze for Loader
impl Send for Loader
impl Sync for Loader
impl Unpin for Loader
impl UnsafeUnpin for Loader
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