EditorContext

Struct EditorContext 

Source
pub struct EditorContext<'a> {
    pub document: Option<&'a mut EditorDocument>,
    pub manager: ExtensionManager,
    pub extension_name: String,
}
Expand description

Editor context providing access to editor functionality Adapts to available features automatically

Fields§

§document: Option<&'a mut EditorDocument>

Current document (if any)

§manager: ExtensionManager
Available on crate feature multi-thread only.

Reference to the extension manager

§extension_name: String

Name of the current extension

Trait Implementations§

Source§

impl<'a> ExtensionContext for EditorContext<'a>

Source§

fn current_document(&self) -> Option<&EditorDocument>

Get the current document (if any)
Source§

fn current_document_mut(&mut self) -> Option<&mut EditorDocument>

Get a mutable reference to the current document
Source§

fn send_event(&mut self, _event: DocumentEvent) -> Result<()>

Send an event to the event system
Source§

fn get_config(&self, key: &str) -> Option<String>

Get configuration value
Source§

fn set_config(&mut self, key: String, value: String) -> Result<()>

Set configuration value
Source§

fn register_command(&mut self, _command: ExtensionCommand) -> Result<()>

Register a command with the editor
Source§

fn show_message(&mut self, _message: &str, _level: MessageLevel) -> Result<()>

Show a message to the user
Source§

fn get_extension_data(&self, extension_name: &str, key: &str) -> Option<String>

Get data from another extension
Source§

fn set_extension_data(&mut self, key: String, value: String) -> Result<()>

Set data for inter-extension communication

Auto Trait Implementations§

§

impl<'a> Freeze for EditorContext<'a>

§

impl<'a> !RefUnwindSafe for EditorContext<'a>

§

impl<'a> Send for EditorContext<'a>

§

impl<'a> !Sync for EditorContext<'a>

§

impl<'a> Unpin for EditorContext<'a>

§

impl<'a> !UnwindSafe for EditorContext<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.