Skip to content

uuid!("") literal macro #422

@awakecoding

Description

@awakecoding

I am looking for a way to specify uuid literals in my code without having to do Uuid::parse_str("").unwrap(); at runtime. A good example for a different use case is the hex-literal crate (https://crates.io/crates/hex-literal) that makes is easy to specify hex literals with the hex!() macro. In this case, I would like to declare a UUID as a string like "cc58f58b-ca41-4678-b9f9-94ba4eeb9e1e" and have it checked for validity at compile-time to avoid the unwrap().

Maybe the best way would be to have the macro define a byte array to use Uuid::from_bytes() under the hood. Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions