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
impl SyntaxStreamState
Sourcepub fn subscribe(&mut self) -> Receiver<TokenUpdate>
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.
Sourcepub const fn subscriber_count(&self) -> usize
pub const fn subscriber_count(&self) -> usize
Get the number of active subscribers.
Sourcepub const fn has_subscribers(&self) -> bool
pub const fn has_subscribers(&self) -> bool
Check if there are no subscribers.
Sourcepub fn broadcast(&mut self, update: &TokenUpdate)
pub fn broadcast(&mut self, update: &TokenUpdate)
Broadcast a token update to all subscribers.
Removes disconnected subscribers automatically.
Sourcepub fn notify_edit(
&mut self,
syntax: &mut SyntaxSessionState,
buffer_id: BufferId,
content: &str,
edit: &SyntaxEdit,
start_line: u64,
end_line: u64,
)
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:
- Updates the syntax driver incrementally via
driver.update() - Gets updated tokens for the affected region
- Broadcasts
TokenUpdateto all subscribers
§Arguments
syntax- The syntax session state containing driversbuffer_id- The buffer that was modifiedcontent- The full buffer content after the editedit- The edit description for incremental parsingstart_line- First line affected by the edit (forTokenUpdate)end_line- Last line affected by the edit (forTokenUpdate)
Sourcepub fn send_full_refresh(
&mut self,
syntax: &SyntaxSessionState,
buffer_id: BufferId,
total_lines: u64,
)
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
impl Debug for SyntaxStreamState
Source§impl Default for SyntaxStreamState
impl Default for SyntaxStreamState
Source§fn default() -> SyntaxStreamState
fn default() -> SyntaxStreamState
Source§impl SessionExtension for SyntaxStreamState
impl SessionExtension for SyntaxStreamState
Source§fn as_text_input_sink(&mut self) -> Option<&mut dyn TextInputSink>
fn as_text_input_sink(&mut self) -> Option<&mut dyn TextInputSink>
TextInputSink if this extension accepts text input. Read moreAuto Trait Implementations§
impl Freeze for SyntaxStreamState
impl RefUnwindSafe for SyntaxStreamState
impl Send for SyntaxStreamState
impl Sync for SyntaxStreamState
impl Unpin for SyntaxStreamState
impl UnsafeUnpin for SyntaxStreamState
impl UnwindSafe for SyntaxStreamState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> SessionExtensionDyn for Twhere
T: SessionExtension,
impl<T> SessionExtensionDyn for Twhere
T: SessionExtension,
Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut dyn Any for mutable downcasting.Source§fn as_text_input_sink(&mut self) -> Option<&mut dyn TextInputSink>
fn as_text_input_sink(&mut self) -> Option<&mut dyn TextInputSink>
TextInputSink if this extension accepts text input.