Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
zeozeozeo committed Jan 31, 2024
1 parent b1066e7 commit 712a53a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/sound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,26 +842,29 @@ impl From<Sound> for SoundHandle {

impl SoundHandle {
/// Make a new [`SoundHandle`] from a [`Sound`].
#[inline] pub fn new(sound: Sound) -> Self {
#[inline]
pub fn new(sound: Sound) -> Self {
Self(Arc::new(Mutex::new(sound)))
}

/// Lock the [`Sound`] for modification. Returns a [`MutexGuard`].
#[inline] pub fn guard(&self) -> MutexGuard<Sound> {
#[inline]
pub fn guard(&self) -> MutexGuard<Sound> {
self.0.lock()
}

/// Delegate to the underlying [`Sound`].
#[inline] pub fn loop_enabled(&self) -> bool {
#[inline]
pub fn loop_enabled(&self) -> bool {
return self.guard().loop_enabled;
}
}

macro_rules! delegate {
($($name:ident($($arg:ident: $type:ty),*) -> $ret:ty),* $(,)?) => {
$(
#[inline]
/// Delegate to the underlying [`Sound`]'s method.
#[inline]
pub fn $name(&self, $($arg: $type),*) -> $ret {
self.guard().$name($($arg),*)
}
Expand Down Expand Up @@ -907,4 +910,4 @@ impl SoundHandle {
paused() -> bool,
resume() -> (),
}
}
}

0 comments on commit 712a53a

Please sign in to comment.