pub struct MutationTask<'a, N: Grammar, H: TaskHandle = TriggerHandle, S: SyncBuildHasher = RandomState> { /* private fields */ }Expand description
A task that grants access to change the content of the documents managed by the Analyzer.
This kind of task implements a MutationAccess trait through which you can create, delete, or edit the existing documents’ content, but you cannot read attributes of the semantic graph.
You may have as many instances of this task as needed at the same time, and you can use them from multiple threads to manage distinct documents.
The analyzer allows you to edit independent documents concurrently, but if two independent threads would edit the same document, one of them will block until another one finishes its job.
Trait Implementations§
Source§impl<'a, N: Grammar, H: TaskHandle, S: SyncBuildHasher> AbstractTask<N, H, S> for MutationTask<'a, N, H, S>
impl<'a, N: Grammar, H: TaskHandle, S: SyncBuildHasher> AbstractTask<N, H, S> for MutationTask<'a, N, H, S>
Source§fn handle(&self) -> &H
fn handle(&self) -> &H
Returns a handle of the task through which you can
manually check if the task has been interrupted, and through which you
can interrupt the task manually.
Source§fn proceed(&self) -> AnalysisResult<()>
fn proceed(&self) -> AnalysisResult<()>
A convenient function that checks if the task was interrupted. Read more
Source§fn contains_doc(&self, id: Id) -> bool
fn contains_doc(&self, id: Id) -> bool
Returns true, if the analyzer has a document with the
id identifier.Source§fn read_doc(&self, id: Id) -> AnalysisResult<DocumentReadGuard<'_, N, S>>
fn read_doc(&self, id: Id) -> AnalysisResult<DocumentReadGuard<'_, N, S>>
Returns a RAII guard that provides read-only access to the analyzer’s
document with specified
id. Read moreSource§fn try_read_doc(&self, id: Id) -> Option<DocumentReadGuard<'_, N, S>>
fn try_read_doc(&self, id: Id) -> Option<DocumentReadGuard<'_, N, S>>
Returns a RAII guard that provides read-only access to the analyzer’s
document with specified
id. Read moreSource§fn is_doc_mutable(&self, id: Id) -> bool
fn is_doc_mutable(&self, id: Id) -> bool
Returns true if the document with the specified
id exists in
the analyzer, and this document allows
content edit operations.Source§fn is_doc_immutable(&self, id: Id) -> bool
fn is_doc_immutable(&self, id: Id) -> bool
Returns true if the document with the specified
id exists in
the analyzer, and this document does not allow
content edit operations.Source§fn snapshot_class(
&self,
id: Id,
class: &<N::Classifier as Classifier>::Class,
) -> AnalysisResult<Shared<HashSet<NodeRef, S>>>
fn snapshot_class( &self, id: Id, class: &<N::Classifier as Classifier>::Class, ) -> AnalysisResult<Shared<HashSet<NodeRef, S>>>
Returns a snapshot of the node references set of the document
with
id that refer to syntax tree nodes belonging to specified class. Read moreSource§fn common(&self) -> &N::CommonSemantics
fn common(&self) -> &N::CommonSemantics
Provides access to the Analyzer’s
common semantics, a special semantic
feature that is instantiated during the Analyzer’s creation. It does
not belong to any specific document and is common across the entire
Analyzer. Read more
Source§impl<'a, N: Grammar, H: TaskHandle, S: SyncBuildHasher> Drop for MutationTask<'a, N, H, S>
impl<'a, N: Grammar, H: TaskHandle, S: SyncBuildHasher> Drop for MutationTask<'a, N, H, S>
Source§impl<'a, N: Grammar, H: TaskHandle, S: SyncBuildHasher> MutationAccess<N, H, S> for MutationTask<'a, N, H, S>
impl<'a, N: Grammar, H: TaskHandle, S: SyncBuildHasher> MutationAccess<N, H, S> for MutationTask<'a, N, H, S>
Source§fn add_mutable_doc(&mut self, text: impl Into<TokenBuffer<N::Token>>) -> Id
fn add_mutable_doc(&mut self, text: impl Into<TokenBuffer<N::Token>>) -> Id
Source§fn add_immutable_doc(&mut self, text: impl Into<TokenBuffer<N::Token>>) -> Id
fn add_immutable_doc(&mut self, text: impl Into<TokenBuffer<N::Token>>) -> Id
Source§fn write_to_doc(
&mut self,
id: Id,
span: impl ToSpan,
text: impl AsRef<str>,
) -> AnalysisResult<()>
fn write_to_doc( &mut self, id: Id, span: impl ToSpan, text: impl AsRef<str>, ) -> AnalysisResult<()>
Source§fn remove_doc(&mut self, id: Id) -> bool
fn remove_doc(&mut self, id: Id) -> bool
Source§fn trigger_event(&mut self, id: Id, event: Event)
fn trigger_event(&mut self, id: Id, event: Event)
Invalidates semantic graph attributes
associated with the corresponding
event and the id parameters. Read moreAuto Trait Implementations§
impl<'a, N, H, S> Freeze for MutationTask<'a, N, H, S>
impl<'a, N, H, S> RefUnwindSafe for MutationTask<'a, N, H, S>
impl<'a, N, H, S> Send for MutationTask<'a, N, H, S>
impl<'a, N, H, S> Sync for MutationTask<'a, N, H, S>
impl<'a, N, H, S> Unpin for MutationTask<'a, N, H, S>
impl<'a, N, H, S> UnsafeUnpin for MutationTask<'a, N, H, S>
impl<'a, N, H, S> UnwindSafe for MutationTask<'a, N, H, S>
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