pub struct MusicLibrary {
pub playlists: Vec<Arc<Playlist>>,
pub favorites: HashSet<LibraryItem>,
pub tracks: Vec<Arc<Track>>,
pub albums: Vec<Arc<Album>>,
pub artists: Vec<Arc<Artist>>,
pub genres: Vec<Arc<Genre>>,
pub total_duration: Duration,
/* private fields */
}Fields§
§playlists: Vec<Arc<Playlist>>§favorites: HashSet<LibraryItem>§tracks: Vec<Arc<Track>>§albums: Vec<Arc<Album>>§artists: Vec<Arc<Artist>>§genres: Vec<Arc<Genre>>§total_duration: DurationImplementations§
Source§impl MusicLibrary
impl MusicLibrary
pub fn find_track_by_path(&self, path: &str) -> Option<Arc<Track>>
pub fn find_artist(&self, name: &str) -> Option<&Arc<Artist>>
pub fn find_playlist_by_name(&self, name: &str) -> Option<&Arc<Playlist>>
pub fn find_playlist_by_id(&self, id: u64) -> Option<&Arc<Playlist>>
pub fn find_album(&self, title: &str) -> Option<&Arc<Album>>
pub fn find_genre(&self, name: &str) -> Option<&Arc<Genre>>
Sourcepub fn get_default_playlist_name(&self) -> String
pub fn get_default_playlist_name(&self) -> String
Returns the default playlist name (“New Playlist”).
If a playlist with the default name exists, then a number will be added to the end of the playlist name so it’s unique, eg. “New Playlist 1”, “New Playlist 2”, etc.
Sourcepub fn find_track_by_hash(&self, hash: u64) -> Option<&Arc<Track>>
pub fn find_track_by_hash(&self, hash: u64) -> Option<&Arc<Track>>
Retrieves a track corresponding to the provided hash.
Sourcepub fn find_tracks_by_hashes(&self, hashes: &[u64]) -> HashMatchingResult
pub fn find_tracks_by_hashes(&self, hashes: &[u64]) -> HashMatchingResult
Retrieves tracks corresponding to a list of provided hashes.
pub fn remove_playlists(&mut self, playlists: Vec<&str>) -> Result<(), Error>
pub fn create_playlist( &mut self, name: &str, track_paths: &Option<Vec<PathBuf>>, ) -> Result<(), Error>
pub fn rename_playlist( &mut self, source: &str, target: &str, ) -> Result<(), Error>
pub fn add_tracks(&mut self, name: &str, tracks: &[u64]) -> Result<(), Error>
pub fn remove_tracks( &mut self, name: &str, tracks: Vec<usize>, ) -> Result<(), Error>
pub fn import_m3u8_playlist( &mut self, path: &PathBuf, name: Option<String>, ) -> Result<(), Error>
Sourcepub fn add_favorite(&mut self, favorite: LibraryItem) -> Result<(), Error>
pub fn add_favorite(&mut self, favorite: LibraryItem) -> Result<(), Error>
Adds a new favorite item to the library.
Returns whether the item was already marked as a favorite.
Sourcepub fn remove_favorite(&mut self, favorite: &LibraryItem) -> Result<(), Error>
pub fn remove_favorite(&mut self, favorite: &LibraryItem) -> Result<(), Error>
Removes an item from the favorites list.
Returns whether the item was marked as a favorite.
Trait Implementations§
Source§impl Clone for MusicLibrary
impl Clone for MusicLibrary
Source§impl Debug for MusicLibrary
impl Debug for MusicLibrary
Source§impl PartialEq for MusicLibrary
impl PartialEq for MusicLibrary
impl StructuralPartialEq for MusicLibrary
Auto Trait Implementations§
impl Forget for MusicLibrary
impl Freeze for MusicLibrary
impl Move for MusicLibrary
impl RefUnwindSafe for MusicLibrary
impl Send for MusicLibrary
impl Sync for MusicLibrary
impl Unpin for MusicLibrary
impl UnsafeUnpin for MusicLibrary
impl UnwindSafe for MusicLibrary
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more