Trait StreamType
Source pub trait StreamType: MaybeSend + 'static {
type Config: Default + MaybeSend;
type Events: Clone + MaybeSend + MaybeSync + 'static;
type Source: Source;
// Required method
fn create(
config: Self::Config,
) -> impl Future<Output = Result<Self::Source, SourceError>>;
// Provided method
fn event_bus(config: &Self::Config) -> Option<Self::Events> { ... }
}
Expand description
Defines a stream type and how to create it.
This trait is implemented by marker types (Hls, File) in their respective crates.
The implementation provides the config type and source type.
On wasm32, Send/Sync bounds are relaxed via MaybeSend/MaybeSync.
Configuration for this stream type.
Event bus type carried by the stream config.
Concrete stream types set this to kithara_events::EventBus.
Audio::new() constrains T::Events = EventBus to extract it.
Source implementing Source.
Create the source from configuration.
May also start background tasks (downloader) internally.
Extract the event bus from config (if set).
Used by Audio::new() to share a single bus across the stream
and the audio pipeline.
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".