Enum eszip::Eszip

source ·
pub enum Eszip {
    V1(EszipV1),
    V2(EszipV2),
}

Variants§

Implementations§

source§

impl Eszip

source

pub async fn parse<R: AsyncRead + Unpin + 'static>( reader: R ) -> Result<(Eszip, Pin<Box<dyn Future<Output = Result<BufReader<R>, ParseError>>>>), ParseError>

Parse a byte stream into an Eszip. This function completes when the header is fully received. This does not mean that the entire file is fully received or parsed yet. To finish parsing, the future returned by this function in the second tuple slot needs to be polled.

source

pub fn get_module(&self, specifier: &str) -> Option<Module>

Get the module metadata for a given module specifier. This function will follow redirects. The returned module has functions that can be used to obtain the module source and source map. The module returned from this function is guaranteed to be a valid module, which can be loaded into v8.

Note that this function should be used to obtain a module; if you wish to get an import map, use get_import_map instead.

source

pub fn get_import_map(&self, specifier: &str) -> Option<Module>

Get the import map for a given specifier.

Note that this function should be used to obtain an import map; the returned “Module” is not necessarily a valid module that can be loaded into v8 (in other words, JSONC may be returned). If you wish to get a valid module, use get_module instead.

source

pub fn take_npm_snapshot( &mut self ) -> Option<ValidSerializedNpmResolutionSnapshot>

Takes the npm snapshot out of the eszip.

Auto Trait Implementations§

§

impl RefUnwindSafe for Eszip

§

impl Send for Eszip

§

impl Sync for Eszip

§

impl Unpin for Eszip

§

impl UnwindSafe for Eszip

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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
§

impl<T> Send for Twhere T: ?Sized,

§

impl<T> Sync for Twhere T: ?Sized,