pub trait PluginHost: Send + Sync {
Show 36 methods
// Required methods
fn notify(&self, level: NotificationLevel, message: &str);
fn request_repaint(&self);
fn log(&self, level: LogLevel, message: &str);
fn version(&self) -> &'static str;
fn is_wasm(&self) -> bool;
fn theme(&self) -> Theme;
fn theme_name(&self) -> &'static str;
fn clipboard_write(&self, text: &str) -> bool;
fn clipboard_read(&self) -> Option<String>;
fn spawn(&self, future: BoxFuture<()>);
fn http_get(
&self,
url: &str,
headers: &FxHashMap<String, String>,
) -> Result<HttpResponse, HttpError>;
fn http_post(
&self,
url: &str,
body: &str,
headers: &FxHashMap<String, String>,
) -> Result<HttpResponse, HttpError>;
fn add_query_pane(&self, query: &str, title: Option<&str>);
fn add_logs_pane(&self);
fn add_tracing_pane(&self, trace_id: Option<&str>);
fn add_terminal_pane(&self);
fn add_sql_pane(&self);
fn close_focused_pane(&self);
fn focus_pane(&self, direction: &str);
fn set_time_range_preset(&self, preset: &str);
fn set_time_range_absolute(&self, start_secs: f64, end_secs: f64);
fn get_time_range(&self) -> (f64, f64);
fn register_custom_table_pane(&self, config: CustomTableConfig);
fn add_custom_table_pane(&self, pane_type: &str);
fn update_custom_table_data(&self, pane_id: usize, data: CustomTableData);
fn update_custom_table_data_by_type(
&self,
pane_type: &str,
data: CustomTableData,
);
fn register_custom_chart_pane(&self, config: CustomChartConfig);
fn add_custom_chart_pane(&self, pane_type: &str);
fn update_custom_chart_data_by_type(
&self,
pane_type: &str,
data: CustomChartData,
);
fn register_stat_pane(&self, config: StatPaneConfig);
fn add_stat_pane(&self, pane_type: &str);
fn update_stat_data_by_type(&self, pane_type: &str, data: StatPaneData);
fn register_gauge_pane(&self, config: GaugePaneConfig);
fn add_gauge_pane(&self, pane_type: &str);
fn update_gauge_data_by_type(&self, pane_type: &str, data: GaugePaneData);
fn get_focused_pane_info(&self) -> Option<FocusedPaneInfo>;
}Expand description
Trait for the host application to implement.
This provides the interface that plugins use to interact with the host
(typically the Enya editor). The host implements this trait and provides
it to plugins via the PluginContext.
Required Methods§
Sourcefn notify(&self, level: NotificationLevel, message: &str)
fn notify(&self, level: NotificationLevel, message: &str)
Send a notification to the user.
Sourcefn request_repaint(&self)
fn request_repaint(&self)
Request a UI repaint.
Sourcefn theme_name(&self) -> &'static str
fn theme_name(&self) -> &'static str
Get the current theme name as a string (e.g., “tokyo-night”, “catppuccin”).
Sourcefn clipboard_write(&self, text: &str) -> bool
fn clipboard_write(&self, text: &str) -> bool
Write text to the system clipboard. Returns true if successful, false if clipboard is unavailable.
Sourcefn clipboard_read(&self) -> Option<String>
fn clipboard_read(&self) -> Option<String>
Read text from the system clipboard. Returns None if clipboard is empty or unavailable.
Sourcefn spawn(&self, future: BoxFuture<()>)
fn spawn(&self, future: BoxFuture<()>)
Spawn an async task (may not be available in all environments).
Sourcefn http_get(
&self,
url: &str,
headers: &FxHashMap<String, String>,
) -> Result<HttpResponse, HttpError>
fn http_get( &self, url: &str, headers: &FxHashMap<String, String>, ) -> Result<HttpResponse, HttpError>
Perform an HTTP GET request. Returns the response or an error message.
Sourcefn http_post(
&self,
url: &str,
body: &str,
headers: &FxHashMap<String, String>,
) -> Result<HttpResponse, HttpError>
fn http_post( &self, url: &str, body: &str, headers: &FxHashMap<String, String>, ) -> Result<HttpResponse, HttpError>
Perform an HTTP POST request. Returns the response or an error message.
Sourcefn add_query_pane(&self, query: &str, title: Option<&str>)
fn add_query_pane(&self, query: &str, title: Option<&str>)
Add a query pane with the given PromQL query and optional title.
Sourcefn add_logs_pane(&self)
fn add_logs_pane(&self)
Add a logs pane.
Sourcefn add_tracing_pane(&self, trace_id: Option<&str>)
fn add_tracing_pane(&self, trace_id: Option<&str>)
Add a tracing pane, optionally pre-filled with a trace ID.
Sourcefn add_terminal_pane(&self)
fn add_terminal_pane(&self)
Add a terminal pane (native only, no-op on WASM).
Sourcefn add_sql_pane(&self)
fn add_sql_pane(&self)
Add a SQL pane.
Sourcefn close_focused_pane(&self)
fn close_focused_pane(&self)
Close the currently focused pane.
Sourcefn focus_pane(&self, direction: &str)
fn focus_pane(&self, direction: &str)
Focus pane in the given direction (“left”, “right”, “up”, “down”).
Sourcefn set_time_range_preset(&self, preset: &str)
fn set_time_range_preset(&self, preset: &str)
Set time range to a preset (e.g., “5m”, “15m”, “1h”, “6h”, “24h”, “7d”).
Sourcefn set_time_range_absolute(&self, start_secs: f64, end_secs: f64)
fn set_time_range_absolute(&self, start_secs: f64, end_secs: f64)
Set absolute time range (start and end in seconds since Unix epoch).
Sourcefn get_time_range(&self) -> (f64, f64)
fn get_time_range(&self) -> (f64, f64)
Get the current time range as (start_secs, end_secs). Note: This returns cached values; may not reflect real-time updates.
Sourcefn register_custom_table_pane(&self, config: CustomTableConfig)
fn register_custom_table_pane(&self, config: CustomTableConfig)
Register a custom table pane type.
Sourcefn add_custom_table_pane(&self, pane_type: &str)
fn add_custom_table_pane(&self, pane_type: &str)
Add an instance of a custom table pane.
Sourcefn update_custom_table_data(&self, pane_id: usize, data: CustomTableData)
fn update_custom_table_data(&self, pane_id: usize, data: CustomTableData)
Update data for a custom table pane by pane ID. Called by plugins when they have new data to display.
Sourcefn update_custom_table_data_by_type(
&self,
pane_type: &str,
data: CustomTableData,
)
fn update_custom_table_data_by_type( &self, pane_type: &str, data: CustomTableData, )
Update data for all custom table panes of a given type. Called by plugins when they have new data to display.
Sourcefn register_custom_chart_pane(&self, config: CustomChartConfig)
fn register_custom_chart_pane(&self, config: CustomChartConfig)
Register a custom chart pane type.
Sourcefn add_custom_chart_pane(&self, pane_type: &str)
fn add_custom_chart_pane(&self, pane_type: &str)
Add an instance of a custom chart pane.
Sourcefn update_custom_chart_data_by_type(
&self,
pane_type: &str,
data: CustomChartData,
)
fn update_custom_chart_data_by_type( &self, pane_type: &str, data: CustomChartData, )
Update data for all custom chart panes of a given type.
Sourcefn register_stat_pane(&self, config: StatPaneConfig)
fn register_stat_pane(&self, config: StatPaneConfig)
Register a custom stat pane type.
Sourcefn add_stat_pane(&self, pane_type: &str)
fn add_stat_pane(&self, pane_type: &str)
Add an instance of a stat pane.
Sourcefn update_stat_data_by_type(&self, pane_type: &str, data: StatPaneData)
fn update_stat_data_by_type(&self, pane_type: &str, data: StatPaneData)
Update data for all stat panes of a given type.
Sourcefn register_gauge_pane(&self, config: GaugePaneConfig)
fn register_gauge_pane(&self, config: GaugePaneConfig)
Register a custom gauge pane type.
Sourcefn add_gauge_pane(&self, pane_type: &str)
fn add_gauge_pane(&self, pane_type: &str)
Add an instance of a gauge pane.
Sourcefn update_gauge_data_by_type(&self, pane_type: &str, data: GaugePaneData)
fn update_gauge_data_by_type(&self, pane_type: &str, data: GaugePaneData)
Update data for all gauge panes of a given type.
Sourcefn get_focused_pane_info(&self) -> Option<FocusedPaneInfo>
fn get_focused_pane_info(&self) -> Option<FocusedPaneInfo>
Get information about the currently focused pane. Returns None if no pane is focused.