Skip to main content

MutationTask

Struct MutationTask 

Source
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>

Source§

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<()>

A convenient function that checks if the task was interrupted. Read more
Source§

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>>

Returns a RAII guard that provides read-only access to the analyzer’s document with specified id. Read more
Source§

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 more
Source§

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

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>>>

Returns a snapshot of the node references set of the document with id that refer to syntax tree nodes belonging to specified class. Read more
Source§

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>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

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

Creates a mutable Document inside the Analyzer. Read more
Source§

fn add_immutable_doc(&mut self, text: impl Into<TokenBuffer<N::Token>>) -> Id

Creates an immutable Document inside the Analyzer. Read more
Source§

fn write_to_doc( &mut self, id: Id, span: impl ToSpan, text: impl AsRef<str>, ) -> AnalysisResult<()>

Writes user-input edit into the document managed by the Analyzer. Read more
Source§

fn remove_doc(&mut self, id: Id) -> bool

Removes a document managed by the Analyzer. Read more
Source§

fn trigger_event(&mut self, id: Id, event: Event)

Invalidates semantic graph attributes associated with the corresponding event and the id parameters. Read more

Auto Trait Implementations§

§

impl<'a, N, H, S> Freeze for MutationTask<'a, N, H, S>
where &'a Analyzer<N, H, S>: Freeze, &'a H: Freeze,

§

impl<'a, N, H, S> RefUnwindSafe for MutationTask<'a, N, H, S>
where &'a Analyzer<N, H, S>: RefUnwindSafe, &'a H: RefUnwindSafe,

§

impl<'a, N, H, S> Send for MutationTask<'a, N, H, S>
where &'a Analyzer<N, H, S>: Send, &'a H: Send,

§

impl<'a, N, H, S> Sync for MutationTask<'a, N, H, S>
where &'a Analyzer<N, H, S>: Sync, &'a H: Sync,

§

impl<'a, N, H, S> Unpin for MutationTask<'a, N, H, S>
where &'a Analyzer<N, H, S>: Unpin, &'a H: Unpin,

§

impl<'a, N, H, S> UnsafeUnpin for MutationTask<'a, N, H, S>
where &'a Analyzer<N, H, S>: UnsafeUnpin, &'a H: UnsafeUnpin,

§

impl<'a, N, H, S> UnwindSafe for MutationTask<'a, N, H, S>
where &'a Analyzer<N, H, S>: UnwindSafe, &'a H: UnwindSafe,

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.