[][src]Struct melody::Song

pub struct Song {
    pub artist: Option<String>,
    pub album: Option<String>,
    pub title: Option<String>,
    pub track: Option<u32>,
    pub duration: Duration,
    pub genre: Option<String>,
    pub file: PathBuf,
    pub status: Status,
}

Song struct

Fields

artist: Option<String>

Artist of the song

album: Option<String>

Album of the song

title: Option<String>

Title of the song

track: Option<u32>

Track of the song

duration: Duration

Duration of the song

genre: Option<String>

Genre of the song

file: PathBuf

File path to the song

status: Status

Elapsed time of song playing or Start time

Methods

impl Song[src]

pub fn artist(&self) -> Option<&str>[src]

Optionally return the artist of the song If None it wasn't able to read the tags

pub fn album(&self) -> Option<&str>[src]

Optionally return the song's album If None failed to read the tags

pub fn title(&self) -> Option<&str>[src]

Optionally return the title of the song If None it wasn't able to read the tags

pub fn track(&self) -> Option<u32>[src]

Optionally returns the song's track number If None it wasn't able to read the tags

pub fn genre(&self) -> Option<&str>[src]

Optionally returns the song's genre If None it wasn't able to read the tags

pub fn duration(&self) -> Duration[src]

Returns the Duration of the song

pub fn elapsed(&self) -> Duration[src]

Returns the elapsed time the song has been played

pub fn stop(&mut self)[src]

Pause the song

pub fn resume(&mut self)[src]

Resume the song

pub fn is_stopped(&self) -> bool[src]

Check if the song is stopped/paused

pub fn file(&self) -> &Path[src]

Returns the path of the song

pub fn load(file: PathBuf) -> Result<Self, MelodyErrors>[src]

Load song from Pathbuf

pub fn matching_song(&self, s: &Song, matching_genre: bool) -> bool[src]

Checks if the song is the same if matching_genre is true it will check genre as well

pub fn exact_match(&self, s: &Song, same_path: bool) -> bool[src]

Checks if the song is an exact match Checks the song's tags and if the path is the same

Trait Implementations

impl Eq for Song[src]

impl Ord for Song[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl PartialEq<Song> for Song[src]

impl Clone for Song[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialOrd<Song> for Song[src]

impl AsRef<Path> for Song[src]

impl Debug for Song[src]

impl Display for Song[src]

Auto Trait Implementations

impl Send for Song

impl Sync for Song

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]