pub struct TrackQueue { /* private fields */ }Expand description
The queue of a Call, from Call::queue: skip the
current track, clear the waiting ones, see what plays (D-352).
Call::enqueue adds tracks to it; each plays when the one
before it ends. Call::play replaces the current track, and the
waiting ones play after it. A cheap-clone handle; its methods act at once.
discord.js counterpart: none (a bot keeps its own queue and plays the next resource on
AudioPlayerStatus.Idle); songbird: TrackQueue.
§Examples
use djs_voice::Input;
call.enqueue(Input::ffmpeg("one.mp3"));
call.enqueue(Input::ffmpeg("two.mp3"));
let queue = call.queue();
assert_eq!(queue.len(), 2);
queue.skip(); // "two.mp3" plays.
queue.clear(); // Nothing waits any more; "two.mp3" goes on.Implementations§
Source§impl TrackQueue
impl TrackQueue
Sourcepub fn skip(&self) -> bool
pub fn skip(&self) -> bool
Ends the current track (TrackEnd::Skipped) and plays the next one; whether there
was a current track.
songbird counterpart: TrackQueue::skip.
Sourcepub fn clear(&self)
pub fn clear(&self)
Removes the waiting tracks (TrackEnd::Stopped); the current one goes on.
songbird counterpart: TrackQueue::stop (which stops the current one too).
discord.js counterpart: none (@discordjs/voice has no queue).
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
The tracks in the queue: the current one and the waiting ones.
songbird counterpart: TrackQueue::len.
discord.js counterpart: none (@discordjs/voice has no queue).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether nothing plays and nothing waits.
discord.js counterpart: none (@discordjs/voice has no queue).
Sourcepub fn current(&self) -> Option<TrackHandle>
pub fn current(&self) -> Option<TrackHandle>
The track playing (or paused), if any.
songbird counterpart: TrackQueue::current.
discord.js counterpart: the resource of AudioPlayer#state (@discordjs/voice).
Trait Implementations§
Source§impl Clone for TrackQueue
impl Clone for TrackQueue
Source§fn clone(&self) -> TrackQueue
fn clone(&self) -> TrackQueue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TrackQueue
impl RefUnwindSafe for TrackQueue
impl Send for TrackQueue
impl Sync for TrackQueue
impl Unpin for TrackQueue
impl UnsafeUnpin for TrackQueue
impl UnwindSafe for TrackQueue
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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