Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to return a vector of all the handles in a queue #16

Merged
merged 5 commits into from
Nov 19, 2020
Merged

Add function to return a vector of all the handles in a queue #16

merged 5 commits into from
Nov 19, 2020

Conversation

peppizza
Copy link
Contributor

Basically, an extension to current() but returns a vector of all the handles in a queue

Spencer and others added 2 commits November 18, 2020 18:43
@FelixMcFelix FelixMcFelix added enhancement New feature or request tracks Relates to audio control, state, or lifecycle management. labels Nov 18, 2020
Copy link
Member

@FelixMcFelix FelixMcFelix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request. This should be a good convenience method.

A few nits, mainly in naming and pointing out some gotchas in documentation for future users.

@@ -278,6 +278,13 @@ impl TrackQueue {

inner.stop_current()
}

/// Returns Vec of all handles in queue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main points to mention in docs after the headline:

  • Reordering the queue can't be done here, and has to go through modify_queue. The returned Vec is a snapshot of the queue at the time of call, and might change afterwards.
  • Calling stop on a handle will effectively skip that track.

Minor nits:

  • can you please end doc comments with a full stop?
  • Maybe something like "Returns a list of currently queued tracks." for the headline?

@@ -278,6 +278,13 @@ impl TrackQueue {

inner.stop_current()
}

/// Returns Vec of all handles in queue
pub fn to_vec(&self) -> Vec<TrackHandle> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub fn to_vec(&self) -> Vec<TrackHandle> {
pub fn current_queue(&self) -> Vec<TrackHandle> {

This is a little more descriptive of the function's purpose here.

@FelixMcFelix FelixMcFelix merged commit 69acea8 into serenity-rs:current Nov 19, 2020
FelixMcFelix pushed a commit to FelixMcFelix/songbird that referenced this pull request Nov 30, 2020
@FelixMcFelix FelixMcFelix mentioned this pull request Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request tracks Relates to audio control, state, or lifecycle management.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants