Release v0.5.0
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<String, String>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.packagesection in the final link. Expands to a#[used] staticon
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 thecargo:rustc-link-argdirective (for
static-library flows):PackageMetadata,PackageMetadata::from_cargo_toml(),
embed_package_metadata(&md, &opts),EmbedOptions, andEmbedArtifacts. 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 au16. Mirrors the
WindowsVS_FIXEDFILEINFO::FILEVERSIONshape so crash-dump consumers parse
every field without truncation.- Required-field validation for
binary,version,moduleVersion,name,
maintainer,os,osVersion.type,repo,branch,hash,
copyrightare 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 #2
- Add module-info crate v0.5.0 by @ismailhkose in #4
- Bump github/codeql-action from 4.35.2 to 4.35.4 by @dependabot[bot] in #5
- Bump taiki-e/install-action from 2.77.1 to 2.77.2 by @dependabot[bot] in #6
New Contributors
- @microsoft-github-policy-service[bot] made their first contribution in #2
- @ismailhkose made their first contribution in #4
- @dependabot[bot] made their first contribution in #5
Full Changelog: https://github.com/microsoft/module-info/commits/v0.5.0