Skip to content

Commit

Permalink
Added changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrajs16 committed Jul 1, 2024
1 parent 6edf3e8 commit 09973d6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ macro_rules! define_uuid_macro {
#[cfg(feature = "macro-diagnostics")]
#[macro_export]
macro_rules! uuid {
($uuid:ident) => {{
const OUTPUT: $crate::Uuid = match $crate::Uuid::try_parse($uuid) {
$crate::__macro_support::Ok(u) => u,
$crate::__macro_support::Err(_) => panic!("invalid UUID"),
};
OUTPUT
}};
($uuid:literal) => {{
$crate::Uuid::from_bytes($crate::uuid_macro_internal::parse_lit!($uuid))
}};
Expand All @@ -13,14 +20,7 @@ macro_rules! define_uuid_macro {
#[cfg(not(feature = "macro-diagnostics"))]
#[macro_export]
macro_rules! uuid {
($uuid:literal) => {{
const OUTPUT: $crate::Uuid = match $crate::Uuid::try_parse($uuid) {
$crate::__macro_support::Ok(u) => u,
$crate::__macro_support::Err(_) => panic!("invalid UUID"),
};
OUTPUT
}};
($uuid:ident) => {{
($uuid:expr) => {{
const OUTPUT: $crate::Uuid = match $crate::Uuid::try_parse($uuid) {
$crate::__macro_support::Ok(u) => u,
$crate::__macro_support::Err(_) => panic!("invalid UUID"),
Expand Down

0 comments on commit 09973d6

Please sign in to comment.