pub trait Playable {
// Required methods
fn describe(&self) -> Result<PlayableDescriptor>;
fn render_range(&self, cx: &PlayContext) -> Result<PlayStream>;
fn freeze(&self, cx: &PlayContext) -> Result<FrozenPlayable>;
// Provided methods
fn prepare(&mut self, _cx: &PlayContext) -> Result<()> { ... }
fn render_preview(&self, cx: &PlayContext) -> Result<PlayStream> { ... }
fn as_shape(&self) -> PlayableShape { ... }
}Expand description
Object that can describe, render, and freeze itself into play events.
Required Methods§
Sourcefn describe(&self) -> Result<PlayableDescriptor>
fn describe(&self) -> Result<PlayableDescriptor>
Returns the static descriptor for this playable.
Sourcefn render_range(&self, cx: &PlayContext) -> Result<PlayStream>
fn render_range(&self, cx: &PlayContext) -> Result<PlayStream>
Renders the playable over the context’s time range into a stream.
Sourcefn freeze(&self, cx: &PlayContext) -> Result<FrozenPlayable>
fn freeze(&self, cx: &PlayContext) -> Result<FrozenPlayable>
Renders and captures the playable into a FrozenPlayable.
Provided Methods§
Sourcefn prepare(&mut self, _cx: &PlayContext) -> Result<()>
fn prepare(&mut self, _cx: &PlayContext) -> Result<()>
Prepares the playable for rendering under cx; defaults to a no-op.
Sourcefn render_preview(&self, cx: &PlayContext) -> Result<PlayStream>
fn render_preview(&self, cx: &PlayContext) -> Result<PlayStream>
Renders a preview stream; defaults to Playable::render_range.
Sourcefn as_shape(&self) -> PlayableShape
fn as_shape(&self) -> PlayableShape
Returns the object shape; defaults to PlayableShape::music_object.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".