microsoft/module-info v0.5.0
microsoft/module-info
Captured source
source ↗Release v0.5.0
Repository: microsoft/module-info
Tag: v0.5.0
Published: 2026-05-09T01:52:19Z
Prerelease: no
Release notes: First public release
Platform support. ELF .note.package embedding is Linux-only. On non-Linux targets the macros and APIs expand to no-ops so the same source compiles everywhere without #[cfg] guards at each call site.
Minimum supported Rust version: 1.74.
Added
- Build-time embedding of ELF
.note.packagesections containing package
metadata (binary, version, moduleVersion, maintainer, type, repo, branch, hash, copyright, os, osVersion) following the systemd package-metadata spec.
- Runtime access through
get_module_info!, with a single-field form
(get_module_info!(ModuleInfoField::Binary)) and a no-arg form returning a HashMap of every embedded field.
get_version()andget_module_version()accessors for the two most
commonly read fields.
embed!()macro: one-liner at the crate root that keeps the
.note.package section in the final link. Expands to a #[used] static on Linux and to nothing elsewhere, so consumers don't need #[allow(unused_imports)].
- Builder API for
build.rsconsumers that want to supply metadata
programmatically or suppress the cargo:rustc-link-arg directive (for static-library flows): PackageMetadata, PackageMetadata::from_cargo_toml(), embed_package_metadata(&md, &opts), EmbedOptions, and EmbedArtifacts.
Infostruct +module_info::new(Info { … })one-call convenience entry
point. Field names match the embedded JSON shape (r#type, moduleVersion, osVersion).
moduleVersionu16-range validation: rejects any value that isn't exactly
four dot-separated numeric parts each fitting in a u16. Mirrors the Windows VS_FIXEDFILEINFO::FILEVERSION shape so crash-dump consumers parse every field without truncation.
- Required-field validation for
binary,version,moduleVersion,name,
maintainer, os, osVersion. type, repo, branch, hash, copyright are optional and may be left empty; the JSON shape stays fixed so consumers always see the same keys.
- Automatic collection of git (
branch,hash,repo) and OS
(os, osVersion) information, with "unknown" fallbacks when a source is unavailable.
ModuleInfoFieldenum withto_symbol_name(),to_key(), and anALL
slice for iterating every supported field.
ModuleInfoError/ModuleInfoResultwith#[non_exhaustive]so new
variants can land without a semver-major bump.
Crate name. Published as module-info on crates.io. Use module_info::… in Rust import paths because Cargo normalizes hyphens to underscores.
What's Changed
- Adding Microsoft SECURITY.MD by @microsoft-github-policy-service[bot] in https://github.com/microsoft/module-info/pull/2
- Add module-info crate v0.5.0 by @ismailhkose in https://github.com/microsoft/module-info/pull/4
- Bump github/codeql-action from 4.35.2 to 4.35.4 by @dependabot[bot] in https://github.com/microsoft/module-info/pull/5
- Bump taiki-e/install-action from 2.77.1 to 2.77.2 by @dependabot[bot] in https://github.com/microsoft/module-info/pull/6
New Contributors
- @microsoft-github-policy-service[bot] made their first contribution in https://github.com/microsoft/module-info/pull/2
- @ismailhkose made their first contribution in https://github.com/microsoft/module-info/pull/4
- @dependabot[bot] made their first contribution in https://github.com/microsoft/module-info/pull/5
Full Changelog: https://github.com/microsoft/module-info/commits/v0.5.0
Notability
notability 3.0/10Routine tool release, low community signal.