Skip to main content

EnvExt

Trait EnvExt 

Source
pub trait EnvExt: Sealed {
    // Required methods
    fn filename(&self) -> Result<Utf8PathBuf>;
    fn require<T: FromNapiValue>(&self, id: impl AsRef<str>) -> Result<T>;
    fn require_resolve(&self, id: impl AsRef<str>) -> Result<String>;
    fn import(
        &self,
        specifier: impl AsRef<str>,
        options: Option<Object<'_>>,
    ) -> Result<Promise<Object<'_>>>;
    fn import_meta_resolve(&self, specifier: impl AsRef<str>) -> Result<String>;
    fn is_main(&self) -> Result<bool>;
}

Required Methods§

Source

fn filename(&self) -> Result<Utf8PathBuf>

Source

fn require<T: FromNapiValue>(&self, id: impl AsRef<str>) -> Result<T>

Source

fn require_resolve(&self, id: impl AsRef<str>) -> Result<String>

Source

fn import( &self, specifier: impl AsRef<str>, options: Option<Object<'_>>, ) -> Result<Promise<Object<'_>>>

Source

fn import_meta_resolve(&self, specifier: impl AsRef<str>) -> Result<String>

Source

fn is_main(&self) -> Result<bool>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl EnvExt for Env

Source§

fn filename(&self) -> Result<Utf8PathBuf>

Source§

fn require<T: FromNapiValue>(&self, id: impl AsRef<str>) -> Result<T>

Source§

fn require_resolve(&self, id: impl AsRef<str>) -> Result<String>

Source§

fn import( &self, specifier: impl AsRef<str>, options: Option<Object<'_>>, ) -> Result<Promise<Object<'_>>>

Source§

fn import_meta_resolve(&self, specifier: impl AsRef<str>) -> Result<String>

Source§

fn is_main(&self) -> Result<bool>

Implementors§