Skip to main content

SubsystemBoot

Trait SubsystemBoot 

Source
pub trait SubsystemBoot {
    // Required methods
    fn commands_mut(&mut self) -> &mut CommandRegistry;
    fn modes_mut(&mut self) -> &mut ModeRegistry;
    fn services_mut(&mut self) -> &mut ServiceRegistry;
    fn register_service<T: Any + Send + Sync>(&mut self, service: T);
    fn service<T: Any + Send + Sync>(&self) -> Option<Arc<T>>;
    fn inbound<T, H>(&mut self, handler: H) -> InboundBus<T>
       where T: Send + 'static,
             H: FnMut(T) -> Vec<Effect> + Send + 'static;
    fn wake_on_event<E>(&self)
       where E: TypedEvent + Clone;
    fn tick_callback(&mut self, callback: TickCallback);
    fn idle_gate(
        &mut self,
        name: &'static str,
        handler: IdleGateHandler,
    ) -> IdleGateHandle;
    fn event_bus(&self) -> &Arc<EventBus> ⓘ;
    fn runtime_handle(&self) -> &Handle;
    fn buffer_store(&self) -> &BufferStoreHandle;
}
Expand description

The generic-primitive surface a subsystem’s install(boot) wires against.

Implemented by the host’s BootContext. See the module docs for the install pattern and why this is a trait rather than the concrete bundle.

Required Methods§

Source

fn commands_mut(&mut self) -> &mut CommandRegistry

Mutable access to the command registry — register ex-commands, operators, motions, text objects. Valid until the host freezes the registry (after the install list); calling it post-freeze panics.

Source

fn modes_mut(&mut self) -> &mut ModeRegistry

Mutable access to the mode registry — register the subsystem’s major / minor modes. Valid until the host freezes the registry.

Source

fn services_mut(&mut self) -> &mut ServiceRegistry

Mutable access to the service registry — for bulk / multi-step service wiring. Most callers want register_service.

Source

fn register_service<T: Any + Send + Sync>(&mut self, service: T)

Register a single service handle under its TypeId. Per the ServiceRegistry Arc/TypeId rule, register and look up with the same T (register Arc<X> ⇒ look up Arc<X>).

Source

fn service<T: Any + Send + Sync>(&self) -> Option<Arc<T>>

Look up a service by type — the seam a subsystem uses to reach a generic handle another layer owns (e.g. the LSP DiagnosticsQueryHandle the host registered in Phase A) without this trait naming that type. Returns Arc<T>; for an Arc<X> registration this is Arc<Arc<X>>, so unwrap one layer ((*h).clone()).

Source

fn inbound<T, H>(&mut self, handler: H) -> InboundBus<T>
where T: Send + 'static, H: FnMut(T) -> Vec<Effect> + Send + 'static,

The bundled inbound primitive: a channel whose send wakes the editor off-keystroke (the wake is inside the sender — structurally impossible to forget) and whose items are drained per-tick, each run through handler (validate → map to an [Effect] → resolve any oneshot). Returns the sender for the off-thread producer; the drain’s registration is retained for the editor’s lifetime by the host.

Source

fn wake_on_event<E>(&self)
where E: TypedEvent + Clone,

Subscribe a typed event and wake the editor whenever one is published — the off-keystroke-repaint primitive for event-driven work.

Source

fn tick_callback(&mut self, callback: TickCallback)

Register a raw per-tick drain closure (for drains that are not channel inbound buses, e.g. a state-poll). The registration is retained for the editor’s lifetime by the host.

Source

fn idle_gate( &mut self, name: &'static str, handler: IdleGateHandler, ) -> IdleGateHandle

Register an idle gate — a handler the editor actor runs when an armed deadline elapses, applying the Effects it returns and repainting. The subsystem arms it from its own event handler (handle.arm(Instant::now() + delay)) and disarms when the reason evaporates (WK.3).

This is the time-domain peer of inbound: the wake is inside the primitive, so a gate’s effects reach the screen WITHOUT a keystroke. Registering a bare deadline field on the editor instead is the smell this replaces — see idle_gate’s module docs.

Source

fn event_bus(&self) -> &Arc<EventBus> ⓘ

The typed event bus (subscribe / publish).

Source

fn runtime_handle(&self) -> &Handle

The shared async runtime handle (off-thread spawns).

Source

fn buffer_store(&self) -> &BufferStoreHandle

The generic buffer-store handle — the uniform buffer-access substrate (read a buffer’s text / path / id by BufferId).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§