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§
Sourcefn kind(&self) -> ModeKind
fn kind(&self) -> ModeKind
Forwards to Mode::kind.
Sourcefn target_buffer_kind(&self) -> Option<BufferKind>
fn target_buffer_kind(&self) -> Option<BufferKind>
Forwards to Mode::target_buffer_kind.
Sourcefn target_language(&self) -> Option<&str>
fn target_language(&self) -> Option<&str>
Forwards to Mode::target_language.
Sourcefn options(&self) -> OptionOverrideSet
fn options(&self) -> OptionOverrideSet
Forwards to Mode::options.
Sourcefn keymap(&self) -> Keymap
fn keymap(&self) -> Keymap
Forwards to Mode::keymap.
Sourcefn decorations(&self) -> Vec<DecorationProvider>
fn decorations(&self) -> Vec<DecorationProvider>
Forwards to Mode::decorations.
Sourcefn gutter_decorations(&self, ctx: &DecorationCtx<'_>) -> Vec<GutterDecoration>
fn gutter_decorations(&self, ctx: &DecorationCtx<'_>) -> Vec<GutterDecoration>
Forwards to Mode::gutter_decorations.
Sourcefn completion_sources(&self) -> Vec<CompletionSourceContribution>
fn completion_sources(&self) -> Vec<CompletionSourceContribution>
Forwards to Mode::completion_sources.
Sourcefn action_handlers(&self) -> Vec<ActionHandlerContribution>
fn action_handlers(&self) -> Vec<ActionHandlerContribution>
Forwards to Mode::action_handlers.
Sourcefn required_capabilities(&self) -> CapabilitySet
fn required_capabilities(&self) -> CapabilitySet
Forwards to Mode::required_capabilities.
Sourcefn conflicts_with(&self) -> &[ModeId]
fn conflicts_with(&self) -> &[ModeId]
Forwards to Mode::conflicts_with.
Sourcefn implies(&self) -> &[ModeId]
fn implies(&self) -> &[ModeId]
Forwards to Mode::implies.
Sourcefn presents_extensions(&self) -> &[&'static str]
fn presents_extensions(&self) -> &[&'static str]
Forwards to Mode::presents_extensions.
Sourcefn mirrors_option(&self) -> Option<&'static str>
fn mirrors_option(&self) -> Option<&'static str>
Forwards to Mode::mirrors_option.
Sourcefn invocation_runner(&self) -> Option<ModeId>
fn invocation_runner(&self) -> Option<ModeId>
Forwards to Mode::invocation_runner.
Sourcefn refresh_action(&self) -> Option<&'static str>
fn refresh_action(&self) -> Option<&'static str>
Forwards to Mode::refresh_action.
Sourcefn fold_toggle_action(&self) -> Option<&'static str>
fn fold_toggle_action(&self) -> Option<&'static str>
Forwards to Mode::fold_toggle_action.
Sourcefn refresh_on_open(&self) -> bool
fn refresh_on_open(&self) -> bool
Forwards to Mode::refresh_on_open.
Sourcefn activation_policy(&self) -> ActivationPolicy
fn activation_policy(&self) -> ActivationPolicy
Forwards to Mode::activation_policy.
Sourcefn editable_tail(&self) -> Option<EditableTail>
fn editable_tail(&self) -> Option<EditableTail>
Forwards to Mode::editable_tail.
Sourcefn on_activate_dyn<'a>(
&'a self,
ctx: ModeContext,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>, ModeActivationError>> + Send + 'a>>
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".