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§
Sourcefn name(&self) -> &str
fn name(&self) -> &str
Unique name, stored in Track::source ("soundcloud").
Provided Methods§
Sourcefn search_prefix(&self) -> Option<&str>
fn search_prefix(&self) -> Option<&str>
Search prefix without the colon ("scsearch"), if the source searches.
Sourcefn 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 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.
Sourcefn matches_url(&self, _url: &str) -> bool
fn matches_url(&self, _url: &str) -> bool
Whether this source handles url.
Sourcefn 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 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…).
Sourcefn playable(&self) -> Option<&dyn Playable>
fn playable(&self) -> Option<&dyn Playable>
The playback capability, if this source can stream audio.
Sourcefn isrc_lookup(&self) -> Option<&dyn IsrcLookup>
fn isrc_lookup(&self) -> Option<&dyn IsrcLookup>
ISRC lookup capability, used to mirror metadata-only sources.
Sourcefn recommender(&self) -> Option<&dyn Recommender>
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".