Struct wdl_analysis::Analyzer
source · pub struct Analyzer<Context> { /* private fields */ }Expand description
Represents a Workflow Description Language (WDL) document analyzer.
By default, analysis parses documents, performs validation checks, resolves imports, and performs type checking.
Each analysis operation is processed in order of request; however, the individual parsing, resolution, and analysis of documents is performed across a thread pool.
Note that dropping the analyzer is a blocking operation as it will wait for the queue thread to join.
The type parameter is the context type passed to the progress callback.
Implementations§
source§impl<Context> Analyzer<Context>
impl<Context> Analyzer<Context>
sourcepub fn new<Progress, Return>(progress: Progress) -> Self
pub fn new<Progress, Return>(progress: Progress) -> Self
Constructs a new analyzer.
The provided progress callback will be invoked during analysis.
The analyzer will use a default validator for validation.
The analyzer must be constructed from the context of a Tokio runtime.
sourcepub fn new_with_validator<Progress, Return, Validator>(
progress: Progress,
validator: Validator,
) -> Self
pub fn new_with_validator<Progress, Return, Validator>( progress: Progress, validator: Validator, ) -> Self
Constructs a new analyzer with the given validator function.
The provided progress callback will be invoked during analysis.
This validator function will be called once per worker thread to initialize a thread-local validator.
The analyzer must be constructed from the context of a Tokio runtime.
sourcepub async fn add_documents(&self, paths: Vec<PathBuf>) -> Result<()>
pub async fn add_documents(&self, paths: Vec<PathBuf>) -> Result<()>
Adds documents to the analyzer.
If a specified path is a directory, it is recursively searched for WDL documents.
Returns an error if there was a problem discovering documents for the specified paths.
sourcepub async fn remove_documents<'a>(&self, documents: Vec<Url>) -> Result<()>
pub async fn remove_documents<'a>(&self, documents: Vec<Url>) -> Result<()>
Removes the specified documents from the analyzer.
If a specified URI is a prefix (i.e. directory) of documents known to the analyzer, those documents will be removed.
Documents are only removed when not referenced from importing documents.
sourcepub fn notify_incremental_change(
&self,
document: Url,
change: IncrementalChange,
) -> Result<()>
pub fn notify_incremental_change( &self, document: Url, change: IncrementalChange, ) -> Result<()>
Notifies the analyzer that a document has an incremental change.
Changes to documents that aren’t known to the analyzer are ignored.
sourcepub fn notify_change(&self, document: Url, discard_pending: bool) -> Result<()>
pub fn notify_change(&self, document: Url, discard_pending: bool) -> Result<()>
Notifies the analyzer that a document has fully changed and should be fetched again.
Changes to documents that aren’t known to the analyzer are ignored.
If discard_pending is true, then any pending incremental changes are
discarded; otherwise, the full change is ignored if there are pending
incremental changes.
sourcepub async fn analyze_document(
&self,
context: Context,
document: Url,
) -> Result<Vec<AnalysisResult>>
pub async fn analyze_document( &self, context: Context, document: Url, ) -> Result<Vec<AnalysisResult>>
Analyzes a specific document.
The provided context is passed to the progress callback.
If the document is up-to-date and was previously analyzed, the current analysis result is returned.
Returns an analysis result for each document that was analyzed.
sourcepub async fn analyze(&self, context: Context) -> Result<Vec<AnalysisResult>>
pub async fn analyze(&self, context: Context) -> Result<Vec<AnalysisResult>>
Performs analysis of all documents.
The provided context is passed to the progress callback.
If a document is up-to-date and was previously analyzed, the current analysis result is returned.
Returns an analysis result for each document that was analyzed.
Trait Implementations§
Auto Trait Implementations§
impl<Context> Freeze for Analyzer<Context>
impl<Context> !RefUnwindSafe for Analyzer<Context>
impl<Context> Send for Analyzer<Context>where
Context: Send,
impl<Context> Sync for Analyzer<Context>where
Context: Send,
impl<Context> Unpin for Analyzer<Context>
impl<Context> !UnwindSafe for Analyzer<Context>
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more