pub struct Handle(/* private fields */);Expand description
A claim on one playing sound, safe to hold across frames.
It names a voice and a generation. Once the sound ends or its voice is stolen the generation moves on and every call with the old handle does nothing, so an engine loop can keep its handle without checking whether it still owns the voice. The generation is 11 bits; a stale handle could alias a live one only after 2048 reallocations of the same voice.
§Example
use psx_sfx::mixer::Handle;
let h = Handle::from_raw(0b00001_00000_00101);
assert_eq!(h.voice(), 5);
assert_eq!(Handle::from_raw(h.raw()), h);Implementations§
Trait Implementations§
impl Copy for Handle
impl Eq for Handle
impl StructuralPartialEq for Handle
Auto Trait Implementations§
impl Freeze for Handle
impl RefUnwindSafe for Handle
impl Send for Handle
impl Sync for Handle
impl Unpin for Handle
impl UnsafeUnpin for Handle
impl UnwindSafe for Handle
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)