pub struct EditorSessionManager { /* private fields */ }Available on crate feature
std only.Expand description
Multi-document session manager with built-in thread-safety
Implementations§
Source§impl EditorSessionManager
impl EditorSessionManager
Sourcepub fn with_config(config: SessionConfig) -> Self
pub fn with_config(config: SessionConfig) -> Self
Create a new session manager with custom configuration
Sourcepub fn create_session(&mut self, session_id: String) -> Result<()>
pub fn create_session(&mut self, session_id: String) -> Result<()>
Create a new session with an empty document
Sourcepub fn create_session_with_document(
&mut self,
session_id: String,
document: EditorDocument,
) -> Result<()>
pub fn create_session_with_document( &mut self, session_id: String, document: EditorDocument, ) -> Result<()>
Create a new session with a specific document
Sourcepub fn switch_session(&mut self, session_id: &str) -> Result<()>
pub fn switch_session(&mut self, session_id: &str) -> Result<()>
Switch to a different session
Sourcepub fn active_session(&self) -> Result<Option<String>>
pub fn active_session(&self) -> Result<Option<String>>
Get the currently active session
Sourcepub fn with_document<F, R>(&self, session_id: &str, f: F) -> Result<R>
pub fn with_document<F, R>(&self, session_id: &str, f: F) -> Result<R>
Execute a function with a read-only reference to a session’s document
Sourcepub fn with_document_mut<F, R>(&mut self, session_id: &str, f: F) -> Result<R>
pub fn with_document_mut<F, R>(&mut self, session_id: &str, f: F) -> Result<R>
Execute a closure with mutable access to a session’s document
Sourcepub fn remove_session(&mut self, session_id: &str) -> Result<EditorSession>
pub fn remove_session(&mut self, session_id: &str) -> Result<EditorSession>
Remove a session
Sourcepub fn list_sessions(&self) -> Result<Vec<String>>
pub fn list_sessions(&self) -> Result<Vec<String>>
List all session IDs
Sourcepub fn stats(&self) -> SessionStats
pub fn stats(&self) -> SessionStats
Get session statistics
Sourcepub fn cleanup_stale_sessions(&mut self, max_age: Duration) -> Result<usize>
pub fn cleanup_stale_sessions(&mut self, max_age: Duration) -> Result<usize>
Perform cleanup of stale sessions
Available on crate feature arena only.
arena only.Reset shared arena to reclaim memory
Sourcepub fn set_extension_registry(&mut self, registry: Arc<ExtensionRegistry>)
Available on crate feature plugins only.
pub fn set_extension_registry(&mut self, registry: Arc<ExtensionRegistry>)
plugins only.Set shared extension registry
Sourcepub fn extension_registry(&self) -> Option<Arc<ExtensionRegistry>>
Available on crate feature plugins only.
pub fn extension_registry(&self) -> Option<Arc<ExtensionRegistry>>
plugins only.Get shared extension registry
Trait Implementations§
Source§impl Clone for EditorSessionManager
Available on crate feature multi-thread only.
impl Clone for EditorSessionManager
Available on crate feature
multi-thread only.Source§impl Debug for EditorSessionManager
impl Debug for EditorSessionManager
Auto Trait Implementations§
impl Freeze for EditorSessionManager
impl !RefUnwindSafe for EditorSessionManager
impl Send for EditorSessionManager
impl Sync for EditorSessionManager
impl Unpin for EditorSessionManager
impl !UnwindSafe for EditorSessionManager
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
Mutably borrows from an owned value. Read more