Skip to main content

SyntaxStreamState

Struct SyntaxStreamState 

Source
pub struct SyntaxStreamState { /* private fields */ }
Expand description

Per-session token streaming state stored in ExtensionMap.

Manages subscriber channels for clients that want real-time token updates via the StreamTokens gRPC endpoint.

§Separation from SyntaxSessionState

Core driver storage lives in reovim-driver-syntax (accessible to modules). This type handles server-only streaming infrastructure that depends on tokio and reovim-protocol (not available to modules).

Implementations§

Source§

impl SyntaxStreamState

Source

pub fn new() -> Self

Create a new empty stream state.

Source

pub fn subscribe(&mut self) -> Receiver<TokenUpdate>

Subscribe to token updates.

Returns a receiver that will receive TokenUpdate messages when buffers are modified and re-tokenized.

§Channel Size

The channel has a buffer of 16 messages. If a client falls behind, older updates may be dropped.

Source

pub const fn subscriber_count(&self) -> usize

Get the number of active subscribers.

Source

pub const fn has_subscribers(&self) -> bool

Check if there are no subscribers.

Source

pub fn broadcast(&mut self, update: &TokenUpdate)

Broadcast a token update to all subscribers.

Removes disconnected subscribers automatically.

Source

pub fn notify_edit( &mut self, syntax: &mut SyntaxSessionState, buffer_id: BufferId, content: &str, edit: &SyntaxEdit, start_line: u64, end_line: u64, )

Notify subscribers of a buffer edit.

This method:

  1. Updates the syntax driver incrementally via driver.update()
  2. Gets updated tokens for the affected region
  3. Broadcasts TokenUpdate to all subscribers
§Arguments
  • syntax - The syntax session state containing drivers
  • buffer_id - The buffer that was modified
  • content - The full buffer content after the edit
  • edit - The edit description for incremental parsing
  • start_line - First line affected by the edit (for TokenUpdate)
  • end_line - Last line affected by the edit (for TokenUpdate)
Source

pub fn send_full_refresh( &mut self, syntax: &SyntaxSessionState, buffer_id: BufferId, total_lines: u64, )

Send a full token refresh for a buffer.

Call this when a new subscriber connects or when a buffer’s language changes.

Trait Implementations§

Source§

impl Debug for SyntaxStreamState

Source§

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

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

impl Default for SyntaxStreamState

Source§

fn default() -> SyntaxStreamState

Returns the “default value” for a type. Read more
Source§

impl SessionExtension for SyntaxStreamState

Source§

fn create() -> Self

Create default state for a new session. Read more
Source§

fn as_text_input_sink(&mut self) -> Option<&mut dyn TextInputSink>

Return self as a TextInputSink if this extension accepts text input. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> SessionExtensionDyn for T

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Get as &dyn Any for downcasting.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Get as &mut dyn Any for mutable downcasting.
Source§

fn as_text_input_sink(&mut self) -> Option<&mut dyn TextInputSink>

Get as TextInputSink if this extension accepts text input.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more