//! Converting between Windows GUIDs and UUIDs. //! //! Windows GUIDs are specified as using mixed endianness. //! What you get will depend on the source of the GUID. //! Functions like `CoCreateGuid` will generate a valid UUID so //! the fields will be naturally ordered for `Uuid::from_fields`. //! Other GUIDs might need to be passed to `Uuid::from_fields_le` //! to have their ordering swapped.
#[test] #[cfg(windows)] fn guid_to_uuid() { use uuid::Uuid; use windows_sys::core;
#[test] #[cfg(windows)] fn guid_to_uuid_le_encoded() { use uuid::Uuid; use windows_sys::core;
// A GUID might not be encoded directly as a UUID // If its fields are stored in little-endian order they might // need to be flipped. Whether or not this is necessary depends // on the source of the GUID let guid_in = core::GUID {
data1: 0x9d22354a,
data2: 0x2755,
data3: 0x304f,
data4: [0x86, 0x47, 0x9d, 0xc5, 0x4e, 0x1e, 0xe1, 0xe8],
};
let uuid = Uuid::from_fields_le(guid_in.data1, guid_in.data2, guid_in.data3, &guid_in.data4);
let guid_out = { let fields = uuid.to_fields_le();
#[test] #[cfg(windows)] fn uuid_from_cocreateguid() { use uuid::{Uuid, Variant, Version}; use windows_sys::core; use windows_sys::Win32::System::Com::CoCreateGuid;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.