pub trait DiffRenderer {
// Required methods
fn provider_name(&self) -> &str;
fn supported_languages(&self) -> Vec<String>;
fn render(&mut self, request: &DiffRequest) -> PluginResult<DiffResponse>;
}Expand description
The runtime-agnostic trait the TUI calls.
Plugins implement this. The SDK glue maps it onto Lua / WASM bindings
behind opaque types. The TUI sees only Box<dyn DiffRenderer>.
Required Methods§
Sourcefn provider_name(&self) -> &str
fn provider_name(&self) -> &str
Returns the unique provider name. Must match the plugin manifest’s
name field for routing.
Sourcefn supported_languages(&self) -> Vec<String>
fn supported_languages(&self) -> Vec<String>
Returns the languages this renderer can handle. Use vec!["*".into()]
for any-language fallback.
Sourcefn render(&mut self, request: &DiffRequest) -> PluginResult<DiffResponse>
fn render(&mut self, request: &DiffRequest) -> PluginResult<DiffResponse>
Render a diff.
Host caches by (hash(old_content), hash(new_content), language, view, word_diff).
On cache miss the implementation must respond promptly — keep work
linear in (old_content.len() + new_content.len()) and avoid I/O.
For very large diffs the host calls this repeatedly with growing
max_lines and uses the truncated flag to know when to ask for more.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".