pub trait AsyncMediaSource:
Send
+ Sync
+ Debug {
// Required methods
fn source_id(&self) -> u64;
fn produce(
&self,
buffer_id: u64,
path: Option<PathBuf>,
line_count: u32,
text: String,
) -> MediaFuture<'_>;
}Expand description
An async, off-render-path producer of a buffer’s inline media blocks.
Required Methods§
Sourcefn source_id(&self) -> u64
fn source_id(&self) -> u64
Stable id of the producing plugin — the teardown key. Two producers with the same id are the same plugin, so a reload replaces rather than duplicates.
Sourcefn produce(
&self,
buffer_id: u64,
path: Option<PathBuf>,
line_count: u32,
text: String,
) -> MediaFuture<'_>
fn produce( &self, buffer_id: u64, path: Option<PathBuf>, line_count: u32, text: String, ) -> MediaFuture<'_>
Produce this buffer’s media blocks off the render path.
text is the buffer’s contents. Passed by value rather than through a
document handle because a media scan reads EVERY line: a handle would
cost one boundary crossing per line, where one copy costs one. The copy
is affordable because this runs on open / edit, not per frame.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".