rune/worker/
task.rs

1use crate::alloc::path::PathBuf;
2use crate::compile::{ItemId, ModId};
3use crate::worker::{Import, WildcardImport};
4use crate::SourceId;
5
6/// A single task that can be fed to the worker.
7pub(crate) enum Task {
8    /// Load a file.
9    LoadFile {
10        /// The kind of loaded file.
11        kind: LoadFileKind,
12        /// The source id of the item being loaded.
13        source_id: SourceId,
14        /// The item of the file to load.
15        mod_item: ModId,
16        /// Unique item stack identifier.
17        mod_item_id: ItemId,
18    },
19    /// Expand a single import.
20    ExpandImport(Import),
21    /// Deferred action, since it requires all modules to be loaded to be able
22    /// to discover all modules.
23    ExpandWildcardImport(WildcardImport),
24}
25
26/// The kind of the loaded module.
27#[derive(Debug)]
28pub(crate) enum LoadFileKind {
29    /// A root file, which determined a URL root.
30    Root,
31    /// A loaded module, which inherits its root from the file it was loaded
32    /// from.
33    Module { root: Option<PathBuf> },
34}