Expand description
Library providing a GUID (Globally Unique Identifier) type. The format is described in Appendix A of the UEFI Specification. This format of GUID is also used in Microsoft Windows.
Examples
Construct a GUID at compile time with the guid!
macro:
use uguid::guid;
let guid = guid!("01234567-89ab-cdef-0123-456789abcdef");
Parse a GUID at runtime from a string:
use uguid::Guid;
let guid: Guid = "01234567-89ab-cdef-0123-456789abcdef".parse().unwrap();
Construct a GUID from its components:
use uguid::Guid;
let guid = Guid::new(
0x01234567_u32.to_le_bytes(),
0x89ab_u16.to_le_bytes(),
0xcdef_u16.to_le_bytes(),
0x01,
0x23,
[0x45, 0x67, 0x89, 0xab, 0xcd, 0xef],
);
Convert to a string or a byte array:
use uguid::guid;
let guid = guid!("01234567-89ab-cdef-0123-456789abcdef");
assert_eq!(guid.to_string(), "01234567-89ab-cdef-0123-456789abcdef");
assert_eq!(
guid.to_bytes(),
[
0x67, 0x45, 0x23, 0x01, 0xab, 0x89, 0xef, 0xcd, 0x01, 0x23, 0x45,
0x67, 0x89, 0xab, 0xcd, 0xef
]
);
Re-exports
pub use bytemuck;
Macros
Structs
Globally-unique identifier.
Error type for Guid::try_parse
and Guid::from_str
.