45 releases
Uses new Rust 2024
| new 1.0.0-rc.11 | Dec 7, 2025 |
|---|---|
| 1.0.0-rc.10 | Dec 5, 2025 |
| 1.0.0-rc.6 | Nov 26, 2025 |
| 1.0.0-beta.34 | Oct 19, 2025 |
| 1.0.0-beta.5 | Aug 31, 2025 |
#915 in Database interfaces
49 downloads per month
Used in 2 crates
3.5MB
49K
SLoC
A crate for building and loading Mago's "prelude".
The prelude contains the pre-compiled Database and CodebaseMetadata for all
of PHP's built-in symbols (functions, classes, constants, etc.). This is
essential for providing accurate analysis, especially in environments like WASM
where stubs cannot be loaded from the filesystem.
Workflow
This crate is split into two parts using a feature flag:
-
At Compile Time (with the
buildfeature):- A
build.rsscript enables thebuildfeature for this crate. - It calls
Prelude::build()to perform the expensive, one-time analysis of all stub files. - It then calls
prelude.encode()to serialize the result into a byte slice. - The bytes are written to a file (e.g.,
prelude.bin) in theOUT_DIR.
- A
-
At Runtime (without the
buildfeature):- The main application uses
include_bytes!to embed theprelude.binfile. - It calls
Prelude::decode()on the bytes to instantly reconstruct the prelude in memory.
- The main application uses
Dependencies
~13–27MB
~338K SLoC