Download next.js/turbopack/crates/turbopack-core/src/module.rs from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.73 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/turbopack/crates/turbopack-core/src/module.rs
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/turbopack/crates/turbopack-core/src/module.rs
-
curl -L -o module.rs https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/turbopack/crates/turbopack-core/src/module.rs
1.73 kB
| use serde::{Deserialize, Serialize}; | |
| use turbo_tasks::{NonLocalValue, ResolvedVc, Vc, trace::TraceRawVcs}; | |
| use crate::{asset::Asset, ident::AssetIdent, reference::ModuleReferences}; | |
| pub enum StyleType { | |
| IsolatedStyle, | |
| GlobalStyle, | |
| } | |
| pub struct OptionStyleType(Option<StyleType>); | |
| /// A module. This usually represents parsed source code, which has references | |
| /// to other modules. | |
| pub trait Module: Asset { | |
| /// The identifier of the [Module]. It's expected to be unique and capture | |
| /// all properties of the [Module]. | |
| fn ident(&self) -> Vc<AssetIdent>; | |
| /// Other [Module]s or [OutputAsset]s referenced from this [Module]. | |
| // TODO refactor to avoid returning [OutputAsset]s here | |
| fn references(self: Vc<Self>) -> Vc<ModuleReferences> { | |
| ModuleReferences::empty() | |
| } | |
| /// Signifies the module itself is async, e.g. it uses top-level await, is a wasm module, etc. | |
| fn is_self_async(self: Vc<Self>) -> Vc<bool> { | |
| Vc::cell(false) | |
| } | |
| /// The style type of the module. | |
| fn style_type(self: Vc<Self>) -> Vc<OptionStyleType> { | |
| Vc::cell(None) | |
| } | |
| } | |
| pub struct OptionModule(Option<ResolvedVc<Box<dyn Module>>>); | |
| pub struct Modules(Vec<ResolvedVc<Box<dyn Module>>>); | |
| impl Modules { | |
| pub fn empty() -> Vc<Self> { | |
| Vc::cell(Vec::new()) | |
| } | |
| } | |