pub struct KernelContext {
pub event_bus: Arc<EventBus>,
pub buffers: Arc<dyn BufferManager>,
pub motion: Arc<MotionEngine>,
pub text_objects: Arc<TextObjectEngine>,
pub global_marks: Arc<RwLock<MarkBank>>,
pub options: Arc<OptionRegistry>,
pub services: Arc<ServiceRegistry>,
}Expand description
Kernel context bundling all kernel services.
This struct provides drivers and modules with access to kernel services.
All fields are Arc-wrapped for cheap cloning and safe concurrent access.
§Example
use reovim_kernel::api::v1::KernelContext;
fn setup_driver(ctx: KernelContext) {
// Access event bus
let _bus = ctx.event_bus.clone();
// Access buffer manager
let count = ctx.buffers.count();
// Context is cheap to clone
let ctx2 = ctx.clone();
}Fields§
§event_bus: Arc<EventBus>Event bus for publish/subscribe communication.
buffers: Arc<dyn BufferManager>Buffer manager for buffer storage and retrieval.
motion: Arc<MotionEngine>Motion calculation engine.
text_objects: Arc<TextObjectEngine>Text object calculation engine.
global_marks: Arc<RwLock<MarkBank>>Global mark storage (A-Z, shared special marks) (#515).
Per-client local marks (a-z) are stored in EditingState.local_marks.
options: Arc<OptionRegistry>Option registry for editor settings.
services: Arc<ServiceRegistry>Service registry for cross-module service discovery.
Provides access to driver and module services like ClipboardProvider.
This is the same registry used in ModuleContext.services.
Implementations§
Source§impl KernelContext
impl KernelContext
Sourcepub fn new(
event_bus: Arc<EventBus>,
buffers: Arc<dyn BufferManager>,
motion: Arc<MotionEngine>,
text_objects: Arc<TextObjectEngine>,
global_marks: Arc<RwLock<MarkBank>>,
options: Arc<OptionRegistry>,
services: Arc<ServiceRegistry>,
) -> Self
pub fn new( event_bus: Arc<EventBus>, buffers: Arc<dyn BufferManager>, motion: Arc<MotionEngine>, text_objects: Arc<TextObjectEngine>, global_marks: Arc<RwLock<MarkBank>>, options: Arc<OptionRegistry>, services: Arc<ServiceRegistry>, ) -> Self
Create a new kernel context.
Source§impl KernelContext
impl KernelContext
Sourcepub fn with_event_bus_and_services(
event_bus: Arc<EventBus>,
services: Arc<ServiceRegistry>,
) -> Self
pub fn with_event_bus_and_services( event_bus: Arc<EventBus>, services: Arc<ServiceRegistry>, ) -> Self
Create a KernelContext with a shared event bus and services.
Uses stub implementations for other fields. Useful for module initialization where modules need to subscribe to events but don’t need buffer management yet (#440).
§Arguments
event_bus- Shared event bus for subscriptionsservices- Shared service registry
Sourcepub fn with_event_bus_services_and_options(
event_bus: Arc<EventBus>,
services: Arc<ServiceRegistry>,
options: Arc<OptionRegistry>,
) -> Self
pub fn with_event_bus_services_and_options( event_bus: Arc<EventBus>, services: Arc<ServiceRegistry>, options: Arc<OptionRegistry>, ) -> Self
Create a KernelContext with shared event bus, services, and options.
This variant allows sharing the option registry between module init
and the final session context (#458). Modules can register options
during init() and they will be available in the session.
§Arguments
event_bus- Shared event bus for subscriptionsservices- Shared service registryoptions- Shared option registry
Trait Implementations§
Source§impl Clone for KernelContext
impl Clone for KernelContext
Source§fn clone(&self) -> KernelContext
fn clone(&self) -> KernelContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more