uuid-rs / uuid

Generate and parse UUIDs.

Home Page:https://www.crates.io/crates/uuid

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement FromParam trait for Uuid from the Rocket web framework crate

LMH01 opened this issue · comments

commented

Motivation
I would like to use the Uuid struct in a rocket request handler. For that Uuid needs to implement the trait FromParam.

Solution
Add a new feature called "rocket" that will enable an implementation of FromParam for Uuid.

Alternatives
I could use a string instead and check if the string represents a Uuid inside the function but doing it this way will result in an unclean error message when this parsing fails. It would be more clean if the function isn't even run when the request guard FromParam fails.

Is it blocking?
Yes, it blocks me from using it in an request handler. I'm currently rewriting the user authentication to use this Uuid instead of a custom struct. See this issue: link

Anything else?
I have already begun to implement this myself, a pull request will follow.

commented

Closing because this can already be archived by enabling the uuid feature inside rocket. See #650 for more information.