Skip to main content

Analysis

Struct Analysis 

Source
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>

Source

pub fn exports_count(&self) -> usize

Number of named exports found.

Source

pub fn reexports_count(&self) -> usize

Number of re-export module specifiers found.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn exports(&self) -> ExportIter<'a, '_>

Iterate over all named exports.

Source

pub fn reexports(&self) -> ExportIter<'a, '_>

Iterate over all re-exports.

Trait Implementations§

Source§

impl Debug for Analysis<'_>

Source§

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

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

impl<'a> Drop for Analysis<'a>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Analysis<'_>

Source§

impl Sync for Analysis<'_>

Auto Trait Implementations§

§

impl<'a> Freeze for Analysis<'a>

§

impl<'a> RefUnwindSafe for Analysis<'a>

§

impl<'a> Unpin for Analysis<'a>

§

impl<'a> UnsafeUnpin for Analysis<'a>

§

impl<'a> UnwindSafe for Analysis<'a>

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.