Skip to main content

PluginHost

Trait PluginHost 

Source
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§

Source

fn notify(&self, level: NotificationLevel, message: &str)

Send a notification to the user.

Source

fn request_repaint(&self)

Request a UI repaint.

Source

fn log(&self, level: LogLevel, message: &str)

Log a message.

Source

fn version(&self) -> &'static str

Get the host application version.

Source

fn is_wasm(&self) -> bool

Check if running in WASM environment.

Source

fn theme(&self) -> Theme

Get the current theme.

Source

fn theme_name(&self) -> &'static str

Get the current theme name as a string (e.g., “tokyo-night”, “catppuccin”).

Source

fn clipboard_write(&self, text: &str) -> bool

Write text to the system clipboard. Returns true if successful, false if clipboard is unavailable.

Source

fn clipboard_read(&self) -> Option<String>

Read text from the system clipboard. Returns None if clipboard is empty or unavailable.

Source

fn spawn(&self, future: BoxFuture<()>)

Spawn an async task (may not be available in all environments).

Source

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.

Source

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.

Source

fn add_query_pane(&self, query: &str, title: Option<&str>)

Add a query pane with the given PromQL query and optional title.

Source

fn add_logs_pane(&self)

Add a logs pane.

Source

fn add_tracing_pane(&self, trace_id: Option<&str>)

Add a tracing pane, optionally pre-filled with a trace ID.

Source

fn add_terminal_pane(&self)

Add a terminal pane (native only, no-op on WASM).

Source

fn add_sql_pane(&self)

Add a SQL pane.

Source

fn close_focused_pane(&self)

Close the currently focused pane.

Source

fn focus_pane(&self, direction: &str)

Focus pane in the given direction (“left”, “right”, “up”, “down”).

Source

fn set_time_range_preset(&self, preset: &str)

Set time range to a preset (e.g., “5m”, “15m”, “1h”, “6h”, “24h”, “7d”).

Source

fn set_time_range_absolute(&self, start_secs: f64, end_secs: f64)

Set absolute time range (start and end in seconds since Unix epoch).

Source

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.

Source

fn register_custom_table_pane(&self, config: CustomTableConfig)

Register a custom table pane type.

Source

fn add_custom_table_pane(&self, pane_type: &str)

Add an instance of a custom table pane.

Source

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.

Source

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.

Source

fn register_custom_chart_pane(&self, config: CustomChartConfig)

Register a custom chart pane type.

Source

fn add_custom_chart_pane(&self, pane_type: &str)

Add an instance of a custom chart pane.

Source

fn update_custom_chart_data_by_type( &self, pane_type: &str, data: CustomChartData, )

Update data for all custom chart panes of a given type.

Source

fn register_stat_pane(&self, config: StatPaneConfig)

Register a custom stat pane type.

Source

fn add_stat_pane(&self, pane_type: &str)

Add an instance of a stat pane.

Source

fn update_stat_data_by_type(&self, pane_type: &str, data: StatPaneData)

Update data for all stat panes of a given type.

Source

fn register_gauge_pane(&self, config: GaugePaneConfig)

Register a custom gauge pane type.

Source

fn add_gauge_pane(&self, pane_type: &str)

Add an instance of a gauge pane.

Source

fn update_gauge_data_by_type(&self, pane_type: &str, data: GaugePaneData)

Update data for all gauge panes of a given type.

Source

fn get_focused_pane_info(&self) -> Option<FocusedPaneInfo>

Get information about the currently focused pane. Returns None if no pane is focused.

Implementors§