mirror of
https://github.com/Dangoware/dango-music-player.git
synced 2025-04-19 10:02:53 -05:00
Changed the TrackGroup trait to IntoIterator
This commit is contained in:
parent
40add98adc
commit
c41044f53f
3 changed files with 10 additions and 12 deletions
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "kushi"
|
name = "kushi"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
description = "A queue built for the Dango Music Player and Oden Music Bot"
|
description = "A queue built for the Dango Music Player and Oden Music Bot"
|
||||||
homepage = "https://github.com/Dangoware/kushi-queue"
|
homepage = "https://github.com/Dangoware/kushi-queue"
|
||||||
|
|
17
src/lib.rs
17
src/lib.rs
|
@ -1,10 +1,11 @@
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
use error::QueueError;
|
use error::QueueError;
|
||||||
use traits::{Location, TrackGroup};
|
|
||||||
|
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod traits;
|
|
||||||
|
pub trait Location {}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
#[derive(Debug, PartialEq, Clone, Copy)]
|
||||||
pub enum QueueState {
|
pub enum QueueState {
|
||||||
|
@ -18,7 +19,7 @@ pub enum QueueState {
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub struct QueueItem<
|
pub struct QueueItem<
|
||||||
T: Debug + Clone + PartialEq, // T: The Singular Item Type
|
T: Debug + Clone + PartialEq, // T: The Singular Item Type
|
||||||
U: Debug + PartialEq + Clone + TrackGroup, // U: The Multi-Item Type. Needs to be tracked as multiple items
|
U: Debug + PartialEq + Clone + IntoIterator, // U: an Iterator
|
||||||
L: Debug + PartialEq + Clone + Copy + Location // L: The Location Type. Optional but maybe useful
|
L: Debug + PartialEq + Clone + Copy + Location // L: The Location Type. Optional but maybe useful
|
||||||
> {
|
> {
|
||||||
pub item: QueueItemType<T, U>,
|
pub item: QueueItemType<T, U>,
|
||||||
|
@ -31,7 +32,7 @@ pub struct QueueItem<
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum QueueItemType<
|
pub enum QueueItemType<
|
||||||
T: Debug + Clone + PartialEq, // T: The Singular Item Type
|
T: Debug + Clone + PartialEq, // T: The Singular Item Type
|
||||||
U: Debug + PartialEq + Clone + TrackGroup, // U: The Multi-Item Type. Needs to be tracked as multiple items
|
U: Debug + PartialEq + Clone + IntoIterator, // U: The Multi-Item Type. Needs to be tracked as multiple items
|
||||||
> {
|
> {
|
||||||
Single(T),
|
Single(T),
|
||||||
Multi(U)
|
Multi(U)
|
||||||
|
@ -39,7 +40,7 @@ pub enum QueueItemType<
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
T: Debug + Clone + PartialEq, // T: The Singular Item Type
|
T: Debug + Clone + PartialEq, // T: The Singular Item Type
|
||||||
U: Debug + PartialEq + Clone + TrackGroup, // U: The Multi-Item Type. Needs to be tracked as multiple items
|
U: Debug + PartialEq + Clone + IntoIterator, // U: The Multi-Item Type. Needs to be tracked as multiple items
|
||||||
> QueueItemType<T, U> {
|
> QueueItemType<T, U> {
|
||||||
pub fn from_single(item: T) -> Self {
|
pub fn from_single(item: T) -> Self {
|
||||||
QueueItemType::Single(item)
|
QueueItemType::Single(item)
|
||||||
|
@ -53,7 +54,7 @@ impl<
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
T: Debug + Clone + PartialEq,
|
T: Debug + Clone + PartialEq,
|
||||||
U: Debug + PartialEq + Clone + TrackGroup,
|
U: Debug + PartialEq + Clone + IntoIterator,
|
||||||
L: Debug + PartialEq + Clone + Copy + Location
|
L: Debug + PartialEq + Clone + Copy + Location
|
||||||
>
|
>
|
||||||
QueueItem<T, U, L> {
|
QueueItem<T, U, L> {
|
||||||
|
@ -70,7 +71,7 @@ QueueItem<T, U, L> {
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
pub struct Queue<
|
pub struct Queue<
|
||||||
T: Debug + Clone + PartialEq, // T: The Singular Item Type
|
T: Debug + Clone + PartialEq, // T: The Singular Item Type
|
||||||
U: Debug + PartialEq + Clone + TrackGroup, // U: The Multi-Item Type. Needs to be tracked as multiple items
|
U: Debug + PartialEq + Clone + IntoIterator, // U: The Multi-Item Type. Needs to be tracked as multiple items
|
||||||
L: Debug + PartialEq + Clone + Copy + Location // L: The Location Type. Optional but maybe useful
|
L: Debug + PartialEq + Clone + Copy + Location // L: The Location Type. Optional but maybe useful
|
||||||
> {
|
> {
|
||||||
pub items: Vec<QueueItem<T, U, L>>,
|
pub items: Vec<QueueItem<T, U, L>>,
|
||||||
|
@ -82,7 +83,7 @@ pub struct Queue<
|
||||||
// TODO: HAndle the First QueueState[looping] and shuffle
|
// TODO: HAndle the First QueueState[looping] and shuffle
|
||||||
impl<
|
impl<
|
||||||
T: Debug + Clone + PartialEq,
|
T: Debug + Clone + PartialEq,
|
||||||
U: Debug + PartialEq + Clone + TrackGroup,
|
U: Debug + PartialEq + Clone + IntoIterator,
|
||||||
L: Debug + PartialEq + Clone + Copy + Location
|
L: Debug + PartialEq + Clone + Copy + Location
|
||||||
> Queue<T, U, L> {
|
> Queue<T, U, L> {
|
||||||
fn has_addhere(&self) -> bool {
|
fn has_addhere(&self) -> bool {
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
pub trait TrackGroup {}
|
|
||||||
|
|
||||||
pub trait Location {}
|
|
Loading…
Reference in a new issue