Struct Jukebox

Source
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>

Source

pub fn start(client: &'a Client) -> Jukebox<'_>

Creates a new handler to the jukebox of the client.

Source

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.

Source

pub fn status(&self) -> Result<JukeboxStatus>

Returns the status of the jukebox.

Source

pub fn play(&self) -> Result<JukeboxStatus>

Tells the jukebox to start playing.

Source

pub fn stop(&self) -> Result<JukeboxStatus>

Tells the jukebox to pause playback.

Source

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.

Source

pub fn add(&self, song: &Song) -> Result<JukeboxStatus>

Adds the song to the jukebox’s playlist.

Source

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.

Source

pub fn add_all(&self, songs: &[Song]) -> Result<JukeboxStatus>

Adds all the songs to the jukebox’s playlist.

Source

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.

Source

pub fn clear(&self) -> Result<JukeboxStatus>

Clears the jukebox’s playlist.

Source

pub fn remove_id(&self, idx: usize) -> Result<JukeboxStatus>

Removes the song at the provided index from the playlist.

Source

pub fn shuffle(&self) -> Result<JukeboxStatus>

Shuffles the jukebox’s playlist.

Source

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§

Source§

impl<'a> Debug for Jukebox<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> 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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
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.
Source§

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

Source§

type Err = <U as TryFrom<T>>::Err

Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Err>

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T