pub struct QueueManager {
items: Vec<MediaItem>,
current_index: Option<usize>,
shuffle: bool,
repeat: RepeatMode,
shuffle_order: Vec<usize>,
history: Vec<usize>,
context: QueueContext,
}Expand description
Queue manager for playlist functionality
TRACES: UR-005, UR-015 | DR-005, DR-020
Fields§
§items: Vec<MediaItem>All items in the queue
current_index: Option<usize>Current item index
shuffle: boolWhether shuffle is enabled
repeat: RepeatModeCurrent repeat mode
shuffle_order: Vec<usize>Shuffled order of indices (used when shuffle is on)
history: Vec<usize>History of played indices (for going back with shuffle)
context: QueueContextContext for the queue (album, playlist, or custom) Used for remote playback transfer to maintain album/playlist context
Implementations§
Source§impl QueueManager
impl QueueManager
pub fn new() -> Self
Sourcepub fn items_mut(&mut self) -> &mut [MediaItem]
pub fn items_mut(&mut self) -> &mut [MediaItem]
Mutable access to queue items.
Used to re-point streaming entries at a completed local download without disturbing queue order, shuffle state, or the current index.
Sourcepub fn current_index(&self) -> Option<usize>
pub fn current_index(&self) -> Option<usize>
Get the current item index
Sourcepub fn is_shuffle(&self) -> bool
pub fn is_shuffle(&self) -> bool
Check if shuffle is enabled
Sourcepub fn repeat_mode(&self) -> RepeatMode
pub fn repeat_mode(&self) -> RepeatMode
Get the current repeat mode
Sourcepub fn context(&self) -> &QueueContext
pub fn context(&self) -> &QueueContext
Get the current queue context (album, playlist, or custom)
Sourcepub fn set_context(&mut self, context: QueueContext)
pub fn set_context(&mut self, context: QueueContext)
Set the queue context
Sourcepub fn set_queue(&mut self, items: Vec<MediaItem>, start_index: usize)
pub fn set_queue(&mut self, items: Vec<MediaItem>, start_index: usize)
Set the queue with new items (resets context to Custom)
Sourcepub fn set_queue_with_context(
&mut self,
items: Vec<MediaItem>,
start_index: usize,
context: QueueContext,
)
pub fn set_queue_with_context( &mut self, items: Vec<MediaItem>, start_index: usize, context: QueueContext, )
Set the queue with new items and explicit context
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clear the queue entirely, returning it to the empty state.
Used when playback genuinely stops (sleep timer fires, or the queue ends
with repeat off) so the frontend’s currentQueueItem becomes null and
the mini player hides. History and shuffle order are reset too.
Sourcepub fn add(&mut self, items: Vec<MediaItem>, position: AddPosition)
pub fn add(&mut self, items: Vec<MediaItem>, position: AddPosition)
Add items to the queue
Sourcepub fn toggle_shuffle(&mut self)
pub fn toggle_shuffle(&mut self)
Toggle shuffle mode
Sourcepub fn cycle_repeat(&mut self)
pub fn cycle_repeat(&mut self)
Cycle through repeat modes
Sourcepub fn has_previous(&self) -> bool
pub fn has_previous(&self) -> bool
Check if there’s a previous item available
Sourcepub fn get_upcoming(&self, count: usize) -> Vec<&MediaItem>
pub fn get_upcoming(&self, count: usize) -> Vec<&MediaItem>
Get the next N upcoming items (for preloading) Returns items that will play after the current item, respecting shuffle order
Sourcepub fn move_item(&mut self, from_index: usize, to_index: usize) -> bool
pub fn move_item(&mut self, from_index: usize, to_index: usize) -> bool
Move an item from one index to another
Sourcepub fn update_current_stream_url(&mut self, new_url: String) -> bool
pub fn update_current_stream_url(&mut self, new_url: String) -> bool
Update the stream URL of the current item (for transcoded seeking) Returns true if the update was successful
Trait Implementations§
Source§impl Clone for QueueManager
impl Clone for QueueManager
Source§fn clone(&self) -> QueueManager
fn clone(&self) -> QueueManager
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for QueueManager
impl Debug for QueueManager
Source§impl Default for QueueManager
impl Default for QueueManager
Source§impl<'de> Deserialize<'de> for QueueManager
impl<'de> Deserialize<'de> for QueueManager
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl NamedType for QueueManager
impl NamedType for QueueManager
fn sid() -> SpectaID
Source§fn named_data_type(
type_map: &mut TypeCollection,
generics: &[DataType],
) -> NamedDataType
fn named_data_type( type_map: &mut TypeCollection, generics: &[DataType], ) -> NamedDataType
Source§fn definition_named_data_type(type_map: &mut TypeCollection) -> NamedDataType
fn definition_named_data_type(type_map: &mut TypeCollection) -> NamedDataType
Source§impl Serialize for QueueManager
impl Serialize for QueueManager
Source§impl Type for QueueManager
impl Type for QueueManager
Source§fn inline(type_map: &mut TypeCollection, generics: Generics<'_>) -> DataType
fn inline(type_map: &mut TypeCollection, generics: Generics<'_>) -> DataType
Source§fn reference(type_map: &mut TypeCollection, generics: &[DataType]) -> Reference
fn reference(type_map: &mut TypeCollection, generics: &[DataType]) -> Reference
definition will be put into the type map.impl Flatten for QueueManager
Auto Trait Implementations§
impl Freeze for QueueManager
impl RefUnwindSafe for QueueManager
impl Send for QueueManager
impl Sync for QueueManager
impl Unpin for QueueManager
impl UnsafeUnpin for QueueManager
impl UnwindSafe for QueueManager
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<'de, D, R> CommandArg<'de, R> for Dwhere
D: Deserialize<'de>,
R: Runtime,
impl<'de, D, R> CommandArg<'de, R> for Dwhere
D: Deserialize<'de>,
R: Runtime,
§fn from_command(command: CommandItem<'de, R>) -> Result<D, InvokeError>
fn from_command(command: CommandItem<'de, R>) -> Result<D, InvokeError>
§impl<T> FunctionArg for Twhere
T: Type,
impl<T> FunctionArg for Twhere
T: Type,
§fn to_datatype(type_map: &mut TypeCollection) -> Option<DataType>
fn to_datatype(type_map: &mut TypeCollection) -> Option<DataType>
DataType]. Read more