Struct itunes_com::wrappers::SourceCollection
source · pub struct SourceCollection { /* private fields */ }Expand description
Safe wrapper over a IITSourceCollection
Implementations§
source§impl SourceCollection
impl SourceCollection
sourcepub fn ItemByName(&self, name: String) -> Result<Source>
pub fn ItemByName(&self, name: String) -> Result<Source>
Returns an IITSource object with the specified name.
sourcepub fn ItemByPersistentID(&self, id: u64) -> Result<Source>
pub fn ItemByPersistentID(&self, id: u64) -> Result<Source>
Returns an IITSource object with the specified persistent ID.
source§impl SourceCollection
impl SourceCollection
sourcepub fn iter(&self) -> Result<Iterator<'_, SourceCollection, Source>>
pub fn iter(&self) -> Result<Iterator<'_, SourceCollection, Source>>
Examples found in repository?
examples/wrappers.rs (line 27)
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
fn show_playlists(iTunes: &itunes_com::wrappers::iTunes) -> windows::core::Result<()> {
let sources = iTunes.Sources()?;
for source in sources.iter()? {
let kind = source.Kind()?;
println!("Source kind: {:?}", kind);
if kind == ITSourceKind::ITSourceKindLibrary {
for pl in source.Playlists()?.iter()? {
let pl_kind = pl.Kind()?;
let tracks = pl.Tracks()?;
let track_count = tracks.iter()?.len();
let first_track = tracks.ItemByPlayOrder(1);
let first_track_name = first_track.and_then(|t| t.Name()).unwrap_or(String::from("<no track>"));
println!(" * {}\t{:?}: {} tracks (first one is {})", pl.Name()?, pl_kind, track_count, first_track_name);
}
}
}
Ok(())
}Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for SourceCollection
impl !Send for SourceCollection
impl !Sync for SourceCollection
impl Unpin for SourceCollection
impl UnwindSafe for SourceCollection
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