pub struct Document { /* private fields */ }
Expand description
Represents an analyzed WDL document.
This type is cheaply cloned.
Implementations§
Source§impl Document
impl Document
Sourcepub fn id(&self) -> &Arc<String>
pub fn id(&self) -> &Arc<String>
Gets the identifier of the document.
This value changes when a document is reanalyzed.
Sourcepub fn path(&self) -> Cow<'_, str>
pub fn path(&self) -> Cow<'_, str>
Gets the path to the document.
If the scheme of the document’s URI is not file
, this will return the
URI as a string. Otherwise, this will attempt to return the path
relative to the current working directory, or the absolute path
failing that.
Sourcepub fn version(&self) -> Option<SupportedVersion>
pub fn version(&self) -> Option<SupportedVersion>
Gets the supported version of the document.
Returns None
if the document could not be parsed or contains an
unsupported version.
Sourcepub fn namespaces(&self) -> impl Iterator<Item = (&str, &Namespace)>
pub fn namespaces(&self) -> impl Iterator<Item = (&str, &Namespace)>
Gets the namespaces in the document.
Sourcepub fn namespace(&self, name: &str) -> Option<&Namespace>
pub fn namespace(&self, name: &str) -> Option<&Namespace>
Gets a namespace in the document by name.
Sourcepub fn task_by_name(&self, name: &str) -> Option<&Task>
pub fn task_by_name(&self, name: &str) -> Option<&Task>
Gets a task in the document by name.
Sourcepub fn workflow(&self) -> Option<&Workflow>
pub fn workflow(&self) -> Option<&Workflow>
Gets a workflow in the document.
Returns None
if the document did not contain a workflow.
Sourcepub fn structs(&self) -> impl Iterator<Item = (&str, &Struct)>
pub fn structs(&self) -> impl Iterator<Item = (&str, &Struct)>
Gets the structs in the document.
Sourcepub fn struct_by_name(&self, name: &str) -> Option<&Struct>
pub fn struct_by_name(&self, name: &str) -> Option<&Struct>
Gets a struct in the document by name.
Sourcepub fn diagnostics(&self) -> &[Diagnostic]
pub fn diagnostics(&self) -> &[Diagnostic]
Gets the analysis diagnostics for the document.
Sourcepub fn sort_diagnostics(&mut self) -> Self
pub fn sort_diagnostics(&mut self) -> Self
Sorts the diagnostics for the document.
§Panics
Panics if there is more than one reference to the document.
Sourcepub fn extend_diagnostics(&mut self, diagnostics: Vec<Diagnostic>) -> Self
pub fn extend_diagnostics(&mut self, diagnostics: Vec<Diagnostic>) -> Self
Extends the diagnostics for the document.
§Panics
Panics if there is more than one reference to the document.
Sourcepub fn find_scope_by_position(&self, position: usize) -> Option<ScopeRef<'_>>
pub fn find_scope_by_position(&self, position: usize) -> Option<ScopeRef<'_>>
Finds a scope based on a position within the document.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Determines if the document, or any documents transitively imported by this document, has errors.
Returns true
if the document, or one of its transitive imports, has at
least one error diagnostic.
Returns false
if the document, and all of its transitive imports, have
no error diagnostics.
Sourcepub fn visit<V: Visitor>(&self, diagnostics: &mut Diagnostics, visitor: &mut V)
pub fn visit<V: Visitor>(&self, diagnostics: &mut Diagnostics, visitor: &mut V)
Visits the document with a pre-order traversal using the provided visitor to visit each element in the document.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnwindSafe for Document
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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