pub struct PluginContext { /* private fields */ }Expand description
Context provided to plugins for interacting with the host.
Implementations§
Source§impl PluginContext
impl PluginContext
Sourcepub fn new(host: PluginHostRef) -> Self
pub fn new(host: PluginHostRef) -> Self
Create a new plugin context with the given host.
Sourcepub fn request_repaint(&self)
pub fn request_repaint(&self)
Request a UI repaint.
Sourcepub fn editor_version(&self) -> &'static str
pub fn editor_version(&self) -> &'static str
Get the host application version.
Sourcepub fn theme_name(&self) -> &'static str
pub fn theme_name(&self) -> &'static str
Get the current theme name as a string.
Sourcepub fn clipboard_write(&self, text: &str) -> bool
pub fn clipboard_write(&self, text: &str) -> bool
Write text to the system clipboard.
Sourcepub fn clipboard_read(&self) -> Option<String>
pub fn clipboard_read(&self) -> Option<String>
Read text from the system clipboard.
Sourcepub fn host(&self) -> &PluginHostRef
pub fn host(&self) -> &PluginHostRef
Get a reference to the underlying host.
Sourcepub fn http_get(
&self,
url: &str,
headers: &FxHashMap<String, String>,
) -> Result<HttpResponse, HttpError>
pub fn http_get( &self, url: &str, headers: &FxHashMap<String, String>, ) -> Result<HttpResponse, HttpError>
Perform an HTTP GET request.
Sourcepub fn http_post(
&self,
url: &str,
body: &str,
headers: &FxHashMap<String, String>,
) -> Result<HttpResponse, HttpError>
pub fn http_post( &self, url: &str, body: &str, headers: &FxHashMap<String, String>, ) -> Result<HttpResponse, HttpError>
Perform an HTTP POST request.
Sourcepub fn add_query_pane(&self, query: &str, title: Option<&str>)
pub fn add_query_pane(&self, query: &str, title: Option<&str>)
Add a query pane with the given PromQL query and optional title.
Sourcepub fn add_logs_pane(&self)
pub fn add_logs_pane(&self)
Add a logs pane.
Sourcepub fn add_tracing_pane(&self, trace_id: Option<&str>)
pub fn add_tracing_pane(&self, trace_id: Option<&str>)
Add a tracing pane, optionally pre-filled with a trace ID.
Sourcepub fn add_terminal_pane(&self)
pub fn add_terminal_pane(&self)
Add a terminal pane (native only, no-op on WASM).
Sourcepub fn add_sql_pane(&self)
pub fn add_sql_pane(&self)
Add a SQL pane.
Sourcepub fn close_focused_pane(&self)
pub fn close_focused_pane(&self)
Close the currently focused pane.
Sourcepub fn focus_pane(&self, direction: &str)
pub fn focus_pane(&self, direction: &str)
Focus pane in the given direction (“left”, “right”, “up”, “down”).
Sourcepub fn set_time_range_preset(&self, preset: &str)
pub fn set_time_range_preset(&self, preset: &str)
Set time range to a preset (e.g., “5m”, “15m”, “1h”, “6h”, “24h”, “7d”).
Sourcepub fn set_time_range_absolute(&self, start_secs: f64, end_secs: f64)
pub fn set_time_range_absolute(&self, start_secs: f64, end_secs: f64)
Set absolute time range (start and end in seconds since Unix epoch).
Sourcepub fn get_time_range(&self) -> (f64, f64)
pub fn get_time_range(&self) -> (f64, f64)
Get the current time range as (start_secs, end_secs).
Sourcepub fn register_custom_table_pane(&self, config: CustomTableConfig)
pub fn register_custom_table_pane(&self, config: CustomTableConfig)
Register a custom table pane type.
Sourcepub fn add_custom_table_pane(&self, pane_type: &str)
pub fn add_custom_table_pane(&self, pane_type: &str)
Add an instance of a custom table pane.
Sourcepub fn update_custom_table_data(&self, pane_id: usize, data: CustomTableData)
pub fn update_custom_table_data(&self, pane_id: usize, data: CustomTableData)
Update data for a custom table pane.
Sourcepub fn update_custom_table_data_by_type(
&self,
pane_type: &str,
data: CustomTableData,
)
pub fn update_custom_table_data_by_type( &self, pane_type: &str, data: CustomTableData, )
Update data for all custom table panes of a given type.
Sourcepub fn register_custom_chart_pane(&self, config: CustomChartConfig)
pub fn register_custom_chart_pane(&self, config: CustomChartConfig)
Register a custom chart pane type.
Sourcepub fn add_custom_chart_pane(&self, pane_type: &str)
pub fn add_custom_chart_pane(&self, pane_type: &str)
Add an instance of a custom chart pane.
Sourcepub fn update_custom_chart_data_by_type(
&self,
pane_type: &str,
data: CustomChartData,
)
pub fn update_custom_chart_data_by_type( &self, pane_type: &str, data: CustomChartData, )
Update data for all custom chart panes of a given type.
Sourcepub fn register_stat_pane(&self, config: StatPaneConfig)
pub fn register_stat_pane(&self, config: StatPaneConfig)
Register a custom stat pane type.
Sourcepub fn add_stat_pane(&self, pane_type: &str)
pub fn add_stat_pane(&self, pane_type: &str)
Add an instance of a stat pane.
Sourcepub fn update_stat_data_by_type(&self, pane_type: &str, data: StatPaneData)
pub fn update_stat_data_by_type(&self, pane_type: &str, data: StatPaneData)
Update data for all stat panes of a given type.
Sourcepub fn register_gauge_pane(&self, config: GaugePaneConfig)
pub fn register_gauge_pane(&self, config: GaugePaneConfig)
Register a custom gauge pane type.
Sourcepub fn add_gauge_pane(&self, pane_type: &str)
pub fn add_gauge_pane(&self, pane_type: &str)
Add an instance of a gauge pane.
Sourcepub fn update_gauge_data_by_type(&self, pane_type: &str, data: GaugePaneData)
pub fn update_gauge_data_by_type(&self, pane_type: &str, data: GaugePaneData)
Update data for all gauge panes of a given type.
Sourcepub fn get_focused_pane_info(&self) -> Option<FocusedPaneInfo>
pub fn get_focused_pane_info(&self) -> Option<FocusedPaneInfo>
Get information about the currently focused pane.
Auto Trait Implementations§
impl Freeze for PluginContext
impl !RefUnwindSafe for PluginContext
impl Send for PluginContext
impl Sync for PluginContext
impl Unpin for PluginContext
impl UnsafeUnpin for PluginContext
impl !UnwindSafe for PluginContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more