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>
where Context: Send + Clone + 'static,

source

pub fn new<Progress, Return>(progress: Progress) -> Self
where Progress: Fn(Context, ProgressKind, usize, usize) -> Return + Send + 'static, Return: Future<Output = ()>,

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.

source

pub fn new_with_validator<Progress, Return, Validator>( progress: Progress, validator: Validator, ) -> Self
where Progress: Fn(Context, ProgressKind, usize, usize) -> Return + Send + 'static, Return: Future<Output = ()>, Validator: Fn() -> Validator + Send + Sync + 'static,

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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§

source§

impl<Context: Debug> Debug for Analyzer<Context>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<C> Drop for Analyzer<C>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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> 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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more