Expand description
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
Modules§
Structs§
- Prelude
- A container for the pre-compiled database and metadata of PHP’s built-in symbols.