pub struct MindMapHandle { /* private fields */ }Expand description
Copyable shared document handle. Mutation always passes through checked core transactions. Individual views own their viewport, editor and mounted nodes.
Implementations§
Source§impl MindMapHandle
impl MindMapHandle
Sourcepub fn document(self) -> Result<MindMapData, MindMapError>
pub fn document(self) -> Result<MindMapData, MindMapError>
Read a reactive persistent snapshot. No internal mutable signal is exposed.
Sourcepub fn selection(self) -> Result<Vec<String>, MindMapError>
pub fn selection(self) -> Result<Vec<String>, MindMapError>
Current selected IDs, reactively tracked.
Sourcepub fn revision(self) -> Result<u64, MindMapError>
pub fn revision(self) -> Result<u64, MindMapError>
Current generation, reactively tracked.
Sourcepub fn is_read_only(self) -> Result<bool, MindMapError>
pub fn is_read_only(self) -> Result<bool, MindMapError>
Whether mutation is disabled.
Sourcepub fn set_before(
self,
hook: impl Fn(&Operation) -> bool + 'static,
) -> Result<(), MindMapError>
pub fn set_before( self, hook: impl Fn(&Operation) -> bool + 'static, ) -> Result<(), MindMapError>
Set a synchronous veto hook. Invoked without a state borrow; reentrant mutations cause the outer operation to fail with StaleOperation.
Sourcepub fn clear_before(self) -> Result<(), MindMapError>
pub fn clear_before(self) -> Result<(), MindMapError>
Clear the veto hook.
Sourcepub fn set_listener(
self,
listener: impl Fn(CoreEvent) + 'static,
) -> Result<(), MindMapError>
pub fn set_listener( self, listener: impl Fn(CoreEvent) + 'static, ) -> Result<(), MindMapError>
Install a host event listener. Events are delivered after releasing state.
Sourcepub fn apply(
self,
operation: Operation,
) -> Result<OperationResult, MindMapError>
pub fn apply( self, operation: Operation, ) -> Result<OperationResult, MindMapError>
Execute a checked mutation using the current before hook.
Sourcepub fn apply_with(
self,
operation: Operation,
options: OperationOptions,
) -> Result<OperationResult, MindMapError>
pub fn apply_with( self, operation: Operation, options: OperationOptions, ) -> Result<OperationResult, MindMapError>
Execute a checked mutation with explicit recording options.
Sourcepub fn select(self, ids: &[String]) -> Result<(), MindMapError>
pub fn select(self, ids: &[String]) -> Result<(), MindMapError>
Select existing IDs, including collapsed descendants.
Sourcepub fn set_read_only(self, value: bool) -> Result<(), MindMapError>
pub fn set_read_only(self, value: bool) -> Result<(), MindMapError>
Enable/disable all document mutation entry points.
Sourcepub fn undo(self) -> Result<(), MindMapError>
pub fn undo(self) -> Result<(), MindMapError>
Undo and restore selection.
Sourcepub fn redo(self) -> Result<(), MindMapError>
pub fn redo(self) -> Result<(), MindMapError>
Redo and restore selection.
Sourcepub fn refresh(self, data: MindMapData) -> Result<(), MindMapError>
pub fn refresh(self, data: MindMapData) -> Result<(), MindMapError>
Validate and replace the document, clearing selection and history.
Sourcepub fn subscribe(
self,
listener: impl Fn(CoreEvent) + 'static,
) -> Result<Subscription, MindMapError>
pub fn subscribe( self, listener: impl Fn(CoreEvent) + 'static, ) -> Result<Subscription, MindMapError>
Add an independent listener. Dropping the returned guard unsubscribes it.
Sourcepub fn register_plugin(
self,
plugin: Plugin,
) -> Result<PluginGuard, MindMapError>
pub fn register_plugin( self, plugin: Plugin, ) -> Result<PluginGuard, MindMapError>
Register a plugin for the lifetime of a guard. No document/history mutation.
Sourcepub fn set_plugin_enabled(
self,
id: &str,
enabled: bool,
) -> Result<(), MindMapError>
pub fn set_plugin_enabled( self, id: &str, enabled: bool, ) -> Result<(), MindMapError>
Toggle an existing registration. Disabled capabilities disappear reactively.
Sourcepub fn has_plugin(self, capability: Capability) -> bool
pub fn has_plugin(self, capability: Capability) -> bool
Test an enabled capability for this document only.
Sourcepub fn plugin_commands(self) -> Result<Vec<Command>, MindMapError>
pub fn plugin_commands(self) -> Result<Vec<Command>, MindMapError>
Commands supplied by enabled plugins.