build_id

Crates.iobuild_id
lib.rsbuild_id
version0.2.1
sourcesrc
created_at2018-07-20 12:27:00.446962
updated_at2019-11-24 11:16:20.060739
descriptionObtain a UUID uniquely representing the build of the current binary.
homepagehttps://github.com/alecmocatta/build_id
repositoryhttps://github.com/alecmocatta/build_id
max_upload_size
id75207
size24,490
Alec Mocatta (alecmocatta)

documentation

https://docs.rs/build_id/0.2.1

README

build_id

Crates.io MIT / Apache 2.0 licensed Build Status

Docs

Obtain a Uuid uniquely representing the build of the current binary.

This is intended to be used to check that different processes are indeed invocations of identically laid out binaries.

As such:

  • It is guaranteed to be identical within multiple invocations of the same binary.
  • It is guaranteed to be different across binaries with different code or data segments or layout.
  • Equality is unspecified if the binaries have identical code and data segments and layout but differ immaterially (e.g. if a timestamp is included in the binary at compile time).

Examples

let local_build_id = build_id::get();
if local_build_id == remote_build_id {
	println!("We're running the same binary as remote!");
} else {
	println!("We're running a different binary to remote");
}

Note

This looks first for linker-inserted build ID / binary UUIDs (i.e. .note.gnu.build-id on Linux; LC_UUID in Mach-O; etc), falling back to hashing the whole binary.

License

Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 46

cargo fmt