Skip to content

Instantly share code, notes, and snippets.

@kinggoesgaming
Created April 25, 2018 22:25
Show Gist options
  • Save kinggoesgaming/ae9ea682a5276e3cda7f962accc4ba95 to your computer and use it in GitHub Desktop.
Save kinggoesgaming/ae9ea682a5276e3cda7f962accc4ba95 to your computer and use it in GitHub Desktop.
macro_rules! uuid_adapter {
($owned:ident, $ref:ident) => {
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct $owned {
inner: Uuid,
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct $ref<'a> {
inner: &'a Uuid,
}
};
}
uuid_adapter!(UuidHyphenated, UuidHyphenatedRef);
uuid_adapter!(UuidSimple, UuidSimpleRef);
uuid_adapter!(UuidUrn, UuidUrnRef);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment