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>(
config: DiagnosticsConfig,
progress: Progress,
) -> Self
pub fn new<Progress, Return>( config: DiagnosticsConfig, progress: Progress, ) -> Self
Constructs a new analyzer with the given diagnostics config.
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>(
config: DiagnosticsConfig,
progress: Progress,
validator: Validator,
) -> Self
pub fn new_with_validator<Progress, Return, Validator>( config: DiagnosticsConfig, progress: Progress, validator: Validator, ) -> Self
Constructs a new analyzer with the given diagnostics config and 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_document(&self, uri: Url) -> Result<()>
pub async fn add_document(&self, uri: Url) -> Result<()>
Adds a document to the analyzer. Document can be a local file or a URL.
Returns an error if the document could not be added.
Sourcepub async fn add_directory(&self, path: PathBuf) -> Result<()>
pub async fn add_directory(&self, path: PathBuf) -> Result<()>
Adds a directory to the analyzer. It will recursively search for WDL documents in the supplied directory.
Returns an error if there was a problem discovering documents for the specified path.
Sourcepub async fn remove_documents(&self, documents: Vec<Url>) -> Result<()>
pub async fn remove_documents(&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