Skip to main content

KernelContext

Struct KernelContext 

Source
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

Source

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

Source

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 subscriptions
  • services - Shared service registry
Source

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 subscriptions
  • services - Shared service registry
  • options - Shared option registry

Trait Implementations§

Source§

impl Clone for KernelContext

Source§

fn clone(&self) -> KernelContext

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KernelContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for KernelContext

Source§

fn default() -> Self

Create a default KernelContext for testing purposes.

Uses stub implementations. Should only be used in tests.

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.