pub struct Queue { /* private fields */ }Expand description
A selection with a cursor and a deterministic playing order.
Implementations§
Source§impl Queue
impl Queue
Sourcepub fn new(tracks: Vec<Id>, seed: Option<u64>) -> Self
pub fn new(tracks: Vec<Id>, seed: Option<u64>) -> Self
Build from the same ordered track IDs used by playlist rendering.
seed = None keeps the selection order. A seed shuffles it with a
fixed algorithm, independently of platform or process state.
Sourcepub fn ordered_tracks(&self) -> impl Iterator<Item = Id> + '_
pub fn ordered_tracks(&self) -> impl Iterator<Item = Id> + '_
IDs in their current playing order.
Sourcepub fn current_entry(&self) -> Option<usize>
pub fn current_entry(&self) -> Option<usize>
Original selection occurrence under the cursor, distinguishing repeats.
Sourcepub fn select_entry(&mut self, entry: usize) -> bool
pub fn select_entry(&mut self, entry: usize) -> bool
Select an existing occurrence after the driver abandons preparation of a later source. Missing occurrences leave the queue unchanged.
Sourcepub fn reorder(
&mut self,
order: Vec<usize>,
seed: Option<u64>,
) -> Result<(), &'static str>
pub fn reorder( &mut self, order: Vec<usize>, seed: Option<u64>, ) -> Result<(), &'static str>
Replace future order, retaining the played prefix and current occurrence.
order must contain every original occurrence exactly once. Invalid
input leaves transport, history, seed and position unchanged. Changing
mode clears saved neighbouring cycles, but not Previous within this one.
Sourcepub fn set_next_order(
&mut self,
order: Vec<usize>,
seed: Option<u64>,
) -> Result<bool, &'static str>
pub fn set_next_order( &mut self, order: Vec<usize>, seed: Option<u64>, ) -> Result<bool, &'static str>
Supply an externally planned next repeat-all cycle.
Return false when Previous has already retained the forward cycle. Such an order must not be silently replaced by a new shuffle draw.
Sourcepub fn next_seed(&self) -> Option<u64>
pub fn next_seed(&self) -> Option<u64>
Reproducible seed for the next shuffled repeat-all cycle.
Sourcepub fn position_ms(&self) -> u64
pub fn position_ms(&self) -> u64
Position in the current track, supplied by the playback driver.
Sourcepub fn set_position_ms(&mut self, position_ms: u64) -> bool
pub fn set_position_ms(&mut self, position_ms: u64) -> bool
Update the observed position after a successful playback or seek. An empty queue cannot acquire a position.
Sourcepub fn set_repeat(&mut self, repeat: Repeat)
pub fn set_repeat(&mut self, repeat: Repeat)
Change how natural ends are handled.
Sourcepub fn play(&mut self) -> Option<Id>
pub fn play(&mut self) -> Option<Id>
Start or resume the selected track; select the first entry if needed.
Sourcepub fn skip_next(&mut self) -> Option<Id>
pub fn skip_next(&mut self) -> Option<Id>
Skip to the next entry, even with repeat-one enabled. Keeps the current playing or paused state until the queue is exhausted.