pub struct Jukebox<'a> { /* private fields */ }
Expand description
A wrapper on a Client
to control just the jukebox.
Any method invoked on a Jukebox
will fail if the user that created the
Client
is not authorized to control the jukebox.
Implementations§
Source§impl<'a> Jukebox<'a>
impl<'a> Jukebox<'a>
Sourcepub fn start(client: &'a Client) -> Jukebox<'_>
pub fn start(client: &'a Client) -> Jukebox<'_>
Creates a new handler to the jukebox of the client.
Sourcepub fn playlist(&self) -> Result<JukeboxPlaylist>
pub fn playlist(&self) -> Result<JukeboxPlaylist>
Returns the current playlist of the jukebox, as well as its status. The status is also returned as it contains the position of the jukebox in its playlist.
Sourcepub fn status(&self) -> Result<JukeboxStatus>
pub fn status(&self) -> Result<JukeboxStatus>
Returns the status of the jukebox.
Sourcepub fn play(&self) -> Result<JukeboxStatus>
pub fn play(&self) -> Result<JukeboxStatus>
Tells the jukebox to start playing.
Sourcepub fn stop(&self) -> Result<JukeboxStatus>
pub fn stop(&self) -> Result<JukeboxStatus>
Tells the jukebox to pause playback.
Sourcepub fn skip_to(&self, n: usize) -> Result<JukeboxStatus>
pub fn skip_to(&self, n: usize) -> Result<JukeboxStatus>
Moves the jukebox’s currently playing song to the provided index (zero-indexed).
Using an index outside the range of the jukebox playlist will play the last song in the playlist.
Sourcepub fn add(&self, song: &Song) -> Result<JukeboxStatus>
pub fn add(&self, song: &Song) -> Result<JukeboxStatus>
Adds the song to the jukebox’s playlist.
Sourcepub fn add_id(&self, id: usize) -> Result<JukeboxStatus>
pub fn add_id(&self, id: usize) -> Result<JukeboxStatus>
Adds a song matching the provided ID to the playlist.
§Errors
The method will return an error if a song matching the provided ID cannot be found.
Sourcepub fn add_all(&self, songs: &[Song]) -> Result<JukeboxStatus>
pub fn add_all(&self, songs: &[Song]) -> Result<JukeboxStatus>
Adds all the songs to the jukebox’s playlist.
Sourcepub fn add_all_ids(&self, ids: &[usize]) -> Result<JukeboxStatus>
pub fn add_all_ids(&self, ids: &[usize]) -> Result<JukeboxStatus>
Adds multiple songs matching the provided IDs to the playlist.
§Errors
The method will return an error if at least one ID cannot be matched to a song.
Sourcepub fn clear(&self) -> Result<JukeboxStatus>
pub fn clear(&self) -> Result<JukeboxStatus>
Clears the jukebox’s playlist.
Sourcepub fn remove_id(&self, idx: usize) -> Result<JukeboxStatus>
pub fn remove_id(&self, idx: usize) -> Result<JukeboxStatus>
Removes the song at the provided index from the playlist.
Sourcepub fn shuffle(&self) -> Result<JukeboxStatus>
pub fn shuffle(&self) -> Result<JukeboxStatus>
Shuffles the jukebox’s playlist.
Sourcepub fn set_volume(&self, volume: f32) -> Result<JukeboxStatus>
pub fn set_volume(&self, volume: f32) -> Result<JukeboxStatus>
Sets the jukebox’s playback volume.
Seting the volume above 1.0
will have no effect.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Jukebox<'a>
impl<'a> !RefUnwindSafe for Jukebox<'a>
impl<'a> Send for Jukebox<'a>
impl<'a> Sync for Jukebox<'a>
impl<'a> Unpin for Jukebox<'a>
impl<'a> !UnwindSafe for Jukebox<'a>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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