Skip to main content

DynMode

Trait DynMode 

Source
pub trait DynMode:
    Send
    + Sync
    + 'static {
Show 22 methods // Required methods fn id(&self) -> ModeId; fn kind(&self) -> ModeKind; fn target_buffer_kind(&self) -> Option<BufferKind>; fn target_language(&self) -> Option<&str>; fn options(&self) -> OptionOverrideSet; fn keymap(&self) -> Keymap; fn decorations(&self) -> Vec<DecorationProvider>; fn gutter_decorations( &self, ctx: &DecorationCtx<'_>, ) -> Vec<GutterDecoration>; fn completion_sources(&self) -> Vec<CompletionSourceContribution>; fn action_handlers(&self) -> Vec<ActionHandlerContribution>; fn required_capabilities(&self) -> CapabilitySet; fn conflicts_with(&self) -> &[ModeId]; fn implies(&self) -> &[ModeId]; fn presents_extensions(&self) -> &[&'static str]; fn mirrors_option(&self) -> Option<&'static str>; fn invocation_runner(&self) -> Option<ModeId>; fn refresh_action(&self) -> Option<&'static str>; fn fold_toggle_action(&self) -> Option<&'static str>; fn refresh_on_open(&self) -> bool; fn activation_policy(&self) -> ActivationPolicy; fn editable_tail(&self) -> Option<EditableTail>; fn on_activate_dyn<'a>( &'a self, ctx: ModeContext, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>, ModeActivationError>> + Send + 'a>>;
}
Expand description

Object-safe adapter for Mode. The registry stores modes as Arc<dyn DynMode>; the blanket impl below box-erases each Mode’s typed Guard into Box<dyn Any + Send> so the dispatcher can stash heterogeneous Guards in a single GuardStore and drop them on deactivation.

Public (not sealed): the trait is implemented automatically for every Mode; consumers never implement DynMode directly. Exposed in pub form because the registry’s public API (Arc<dyn DynMode>) leaks it.

Required Methods§

Source

fn id(&self) -> ModeId

Forwards to Mode::id.

Source

fn kind(&self) -> ModeKind

Forwards to Mode::kind.

Source

fn target_buffer_kind(&self) -> Option<BufferKind>

Source

fn target_language(&self) -> Option<&str>

Forwards to Mode::target_language.

Source

fn options(&self) -> OptionOverrideSet

Forwards to Mode::options.

Source

fn keymap(&self) -> Keymap

Forwards to Mode::keymap.

Source

fn decorations(&self) -> Vec<DecorationProvider>

Forwards to Mode::decorations.

Source

fn gutter_decorations(&self, ctx: &DecorationCtx<'_>) -> Vec<GutterDecoration>

Source

fn completion_sources(&self) -> Vec<CompletionSourceContribution>

Source

fn action_handlers(&self) -> Vec<ActionHandlerContribution>

Forwards to Mode::action_handlers.

Source

fn required_capabilities(&self) -> CapabilitySet

Source

fn conflicts_with(&self) -> &[ModeId]

Forwards to Mode::conflicts_with.

Source

fn implies(&self) -> &[ModeId]

Forwards to Mode::implies.

Source

fn presents_extensions(&self) -> &[&'static str]

Source

fn mirrors_option(&self) -> Option<&'static str>

Forwards to Mode::mirrors_option.

Source

fn invocation_runner(&self) -> Option<ModeId>

Source

fn refresh_action(&self) -> Option<&'static str>

Forwards to Mode::refresh_action.

Source

fn fold_toggle_action(&self) -> Option<&'static str>

Source

fn refresh_on_open(&self) -> bool

Forwards to Mode::refresh_on_open.

Source

fn activation_policy(&self) -> ActivationPolicy

Source

fn editable_tail(&self) -> Option<EditableTail>

Forwards to Mode::editable_tail.

Source

fn on_activate_dyn<'a>( &'a self, ctx: ModeContext, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>, ModeActivationError>> + Send + 'a>>

Type-erased lifecycle entry. Returns a future whose output is the typed Guard erased to Box<dyn Any + Send>. The dispatcher stashes this box keyed by (BufferId, ModeId); deactivation drops it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<M: Mode> DynMode for M