machine_uuids

Crates.iomachine_uuids
lib.rsmachine_uuids
version0.2.0
sourcesrc
created_at2024-05-16 10:35:35.053796
updated_at2024-05-16 10:35:35.053796
descriptionA library to retrieve a machines UUID
homepage
repositoryhttps://github.com/daneb/machine_uuid
max_upload_size
id1241956
size11,224
Dane Balia (daneb)

documentation

https://docs.rs/machine_uuids

README

Machine UUID

A library that retrieves UUID for a machine

This is a fork. Migrated away for continued versioned fixes

OS Support

  1. Windows - depends on WMIC
  2. Linux - depends on /etc/machine-id
  3. macOS - depends on ioreg

Usage

let uuid = machineid::get();

// Based on OS, UUID format will differ
// Windows
assert_eq!("140EF834-2DB3-0F7A-27B4-4CEDFB73167C", uuid);

// Based on OS, UUID format will differ
// Linux
assert_eq!("92cc698195f84d3b85f1cfb0a09e957f", uuid);

// Based on OS, UUID format will differ
// macOS
assert_eq!("F7FA2B78-F7D4-5B1B-A4E3-BACB1BBD95A1", uuid)

TODO

  1. Adhere to API Guidelines
  2. Improve error reporting.
  3. Improve test for Linux UUID to use -

Add this to your Cargo.toml:

[dependencies]
machine_uuid = "0.2.0"
Commit count: 0

cargo fmt