pub struct Analysis<'a> { /* private fields */ }Expand description
A parsed CommonJS analysis result.
The lifetime 'a is tied to the source string passed to parse_commonjs,
because export names may reference slices of the original source buffer
(zero-copy string_view exports from the C++ side).
The handle is freed on drop.
Implementations§
Source§impl<'a> Analysis<'a>
impl<'a> Analysis<'a>
Sourcepub fn exports_count(&self) -> usize
pub fn exports_count(&self) -> usize
Number of named exports found.
Sourcepub fn reexports_count(&self) -> usize
pub fn reexports_count(&self) -> usize
Number of re-export module specifiers found.
Sourcepub fn export_name(&self, index: usize) -> Option<&str>
pub fn export_name(&self, index: usize) -> Option<&str>
Get the name of the export at index.
Returns None if index is out of bounds.
Sourcepub fn export_line(&self, index: usize) -> Option<NonZeroU32>
pub fn export_line(&self, index: usize) -> Option<NonZeroU32>
Get the 1-based source line number of the export at index.
Returns None if index is out of bounds.
Sourcepub fn reexport_name(&self, index: usize) -> Option<&str>
pub fn reexport_name(&self, index: usize) -> Option<&str>
Get the module specifier of the re-export at index.
Returns None if index is out of bounds.
Sourcepub fn reexport_line(&self, index: usize) -> Option<NonZeroU32>
pub fn reexport_line(&self, index: usize) -> Option<NonZeroU32>
Get the 1-based source line number of the re-export at index.
Returns None if index is out of bounds.
Sourcepub fn exports(&self) -> ExportIter<'a, '_> ⓘ
pub fn exports(&self) -> ExportIter<'a, '_> ⓘ
Iterate over all named exports.
Sourcepub fn reexports(&self) -> ExportIter<'a, '_> ⓘ
pub fn reexports(&self) -> ExportIter<'a, '_> ⓘ
Iterate over all re-exports.