pub struct ParsedModuleRef { /* private fields */ }Expand description
Cheap cloneable wrapper around an instance of a module AST.
Implementations§
Source§impl ParsedModuleRef
impl ParsedModuleRef
Sourcepub fn module(&self) -> &ParsedModule
pub fn module(&self) -> &ParsedModule
Returns a reference to the ParsedModule that this instance was loaded from.
Sourcepub fn get_by_index<'ast>(&'ast self, index: NodeIndex) -> AnyRootNodeRef<'ast>
pub fn get_by_index<'ast>(&'ast self, index: NodeIndex) -> AnyRootNodeRef<'ast>
Returns a reference to the AST node at the given index.
Methods from Deref<Target = Parsed<ModModule>>§
Sourcepub fn errors(&self) -> &[ParseError]
pub fn errors(&self) -> &[ParseError]
Returns a list of syntax errors found during parsing.
Sourcepub fn unsupported_syntax_errors(&self) -> &[UnsupportedSyntaxError]
pub fn unsupported_syntax_errors(&self) -> &[UnsupportedSyntaxError]
Returns a list of version-related syntax errors found during parsing.
Sourcepub fn has_valid_syntax(&self) -> bool
pub fn has_valid_syntax(&self) -> bool
Returns true if the parsed source code is valid i.e., it has no ParseErrors.
Note that this does not include version-related UnsupportedSyntaxErrors.
See Parsed::has_no_syntax_errors for a version that takes these into account.
Sourcepub fn has_invalid_syntax(&self) -> bool
pub fn has_invalid_syntax(&self) -> bool
Returns true if the parsed source code is invalid i.e., it has ParseErrors.
Note that this does not include version-related UnsupportedSyntaxErrors.
See Parsed::has_no_syntax_errors for a version that takes these into account.
Sourcepub fn has_no_syntax_errors(&self) -> bool
pub fn has_no_syntax_errors(&self) -> bool
Returns true if the parsed source code does not contain any ParseErrors or
UnsupportedSyntaxErrors.
See Parsed::has_valid_syntax for a version specific to ParseErrors.
Sourcepub fn has_syntax_errors(&self) -> bool
pub fn has_syntax_errors(&self) -> bool
Returns true if the parsed source code contains any ParseErrors or
UnsupportedSyntaxErrors.
See Parsed::has_invalid_syntax for a version specific to ParseErrors.
Sourcepub fn as_result(&self) -> Result<&Parsed<T>, &[ParseError]>
pub fn as_result(&self) -> Result<&Parsed<T>, &[ParseError]>
Returns the Parsed output as a Result, returning Ok if it has no syntax errors,
or Err containing the first ParseError encountered.
Note that any unsupported_syntax_errors will not
cause Err to be returned.
Trait Implementations§
Source§impl Clone for ParsedModuleRef
impl Clone for ParsedModuleRef
Source§fn clone(&self) -> ParsedModuleRef
fn clone(&self) -> ParsedModuleRef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ParsedModuleRef
impl RefUnwindSafe for ParsedModuleRef
impl Send for ParsedModuleRef
impl Sync for ParsedModuleRef
impl Unpin for ParsedModuleRef
impl UnsafeUnpin for ParsedModuleRef
impl UnwindSafe for ParsedModuleRef
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