Use this guide to add Sourcier to an existing Rust project and to configure its feature flags. Sourcier supports Rust 1.99 and later (Edition 2024); the MSRV is verified in CI across feature configurations.
Add the dependency
Section titled “Add the dependency”cargo add sourcierCargo adds the latest 2.0 release and enables the default features.
[dependencies]sourcier = "2.0"You only ever depend on sourcier. It re-exports the full API of the
sourcier-core engine crate, which exists so the implementation can stay
small and the facade stable.
Verify the install
Section titled “Verify the install”Compile a three-line program that touches the public API:
use sourcier::{SourceFilesBuilder, SourceFilesMap};
let files = SourceFilesBuilder::<u8>::new() .add_file("a.rs", b"fn a() {}") .expect("capacity available") .finalize() .expect("no capacity issue");
let _: &str = files.get_path(1).expect("file present");cargo buildA successful build prints nothing. Any unresolved import error means the
dependency did not resolve — check that Cargo.lock contains sourcier.
Trim feature flags
Section titled “Trim feature flags”All features except parallel are enabled by default and forwarded to
sourcier-core. Disable the ones you do not need for a leaner build:
[dependencies]sourcier = { version = "2.0", default-features = false, features = ["view"] }This keeps the line-offset index and byte extraction while dropping serialization and runtime statistics. See Feature flags for the full matrix and what each feature gates.
Next steps
Section titled “Next steps”- Follow for the complete workflow.
- Follow to put the dependency to work.
- Check before trimming further.
