Skip to main content

Source

Trait Source 

Source
pub trait Source:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &str;
    fn track<'life0, 'life1, 'async_trait>(
        &'life0 self,
        identifier: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Track, Failure>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn search_prefix(&self) -> Option<&str> { ... }
    fn search<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _query: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, Failure>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn matches_url(&self, _url: &str) -> bool { ... }
    fn load_url<'life0, 'life1, 'async_trait>(
        &'life0 self,
        url: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<LoadResult, Failure>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn playable(&self) -> Option<&dyn Playable> { ... }
    fn isrc_lookup(&self) -> Option<&dyn IsrcLookup> { ... }
    fn recommender(&self) -> Option<&dyn Recommender> { ... }
}
Expand description

Resolves searches, links and identifiers to tracks.

Required Methods§

Source

fn name(&self) -> &str

Unique name, stored in Track::source ("soundcloud").

Source

fn track<'life0, 'life1, 'async_trait>( &'life0 self, identifier: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Track, Failure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch one track by identifier.

Provided Methods§

Source

fn search_prefix(&self) -> Option<&str>

Search prefix without the colon ("scsearch"), if the source searches.

Source

fn search<'life0, 'life1, 'async_trait>( &'life0 self, _query: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, Failure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Plain-text search.

Source

fn matches_url(&self, _url: &str) -> bool

Whether this source handles url.

Source

fn load_url<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<LoadResult, Failure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve a link (track, playlist, album…).

Source

fn playable(&self) -> Option<&dyn Playable>

The playback capability, if this source can stream audio.

Source

fn isrc_lookup(&self) -> Option<&dyn IsrcLookup>

ISRC lookup capability, used to mirror metadata-only sources.

Source

fn recommender(&self) -> Option<&dyn Recommender>

Recommendation capability (radio/autoplay).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§