Skip to main content

Module

Trait Module 

Source
pub trait Module:
    Send
    + Sync
    + NonLocalValue
    + ValueDebug {
    // Required methods
    fn ident(self: Vc<Self>) -> Vc<AssetIdent>
       where Self: Sized;
    fn source(self: Vc<Self>) -> Vc<OptionSource>
       where Self: Sized;
    fn side_effects(self: Vc<Self>) -> Vc<ModuleSideEffects>
       where Self: Sized;

    // Provided methods
    fn ident_string(self: Vc<Self>) -> Vc<RcStr>
       where Self: Sized { ... }
    fn references(self: Vc<Self>) -> Vc<ModuleReferences>
       where Self: Sized { ... }
    fn is_self_async(self: Vc<Self>) -> Vc<bool>
       where Self: Sized { ... }
}
Expand description

A module. This usually represents parsed source code, which has references to other modules.

For documentation about where this is used and how it fits into the rest of Turbopack, see crate::_layers.

Required Methods§

Source

fn ident(self: Vc<Self>) -> Vc<AssetIdent>
where Self: Sized,

The identifier of the Module. It’s expected to be unique and capture all properties of the Module.

Source

fn source(self: Vc<Self>) -> Vc<OptionSource>
where Self: Sized,

The source of the Module.

Source

fn side_effects(self: Vc<Self>) -> Vc<ModuleSideEffects>
where Self: Sized,

Returns true if the module is marked as free of side effects in package.json or by other means.

Provided Methods§

Source

fn ident_string(self: Vc<Self>) -> Vc<RcStr>
where Self: Sized,

The identifier of the Module as string. It’s expected to be unique and capture all properties of the Module.

Source

fn references(self: Vc<Self>) -> Vc<ModuleReferences>
where Self: Sized,

Other Modules or OutputAssets referenced from this Module.

Source

fn is_self_async(self: Vc<Self>) -> Vc<bool>
where Self: Sized,

Signifies the module itself is async, e.g. it uses top-level await, is a wasm module, etc.

Trait Implementations§

Source§

impl TraitVtablePrototype for Box<dyn Module>

Source§

const LEN: usize = 6usize

Source§

const DEFAULTS: &[Option<&NativeFunction>]

Source§

impl VcValueTrait for Box<dyn Module>

Source§

const IMPL_VTABLES: &'static VTableRegistry<Self::ValueTrait>

The per-trait vtable registry, populated at program load by #[ctor::ctor] functions emitted by each #[turbo_tasks::value_impl] expansion. Read more
Source§

type ValueTrait = dyn Module

Source§

fn get_trait_type_id() -> TraitTypeId

Returns the type id of the trait object.
Source§

impl Dynamic<Box<dyn Module>> for Box<dyn Module>

Source§

impl Dynamic<Box<dyn ValueDebug>> for Box<dyn Module>

Available on debug-assertions enabled only.
Source§

impl Upcast<Box<dyn Module>> for Box<dyn Module>

Source§

impl Upcast<Box<dyn ValueDebug>> for Box<dyn Module>

Available on debug-assertions enabled only.
Source§

impl UpcastStrict<Box<dyn ValueDebug>> for Box<dyn Module>

Available on debug-assertions enabled only.

Implementors§

Source§

impl Module for NodeAddonModule

Source§

impl Module for RawModule

Source§

impl<T> Module for T
where T: Dynamic<Box<dyn Module>> + Send + Sync + NonLocalValue + ValueDebug,