Docs rewrite

This commit is contained in:
2026-07-03 10:23:45 +02:00
parent 6cda69044a
commit ec857525b4
23 changed files with 1084 additions and 1134 deletions
+29
View File
@@ -0,0 +1,29 @@
---
title: Modules & Imports
description: Module declarations, imports, re-exports, and module resolution rules.
icon: FolderTree
---
```mist
// Declare a submodule
pub module foo;
// Import
use std::collections::HashMap;
// Re-exporting import
pub use my_module::MyType;
```
### Module Resolution
Mist maps the module tree to Rust's module system:
| Mist Path | Rust Output |
|------------------------------|------------------------------|
| `src/main.mist` | `.mist/src/main.rs` |
| `src/utils/package.mist` | `.mist/src/utils/mod.rs` |
| `src/foo.mist` | `.mist/src/foo.rs` |
| `src/utils/helper.mist` | `.mist/src/utils/helper.rs` |
A `package.mist` file acts as a directory's module root, analogous to `mod.rs`.