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

Export `error::InvalidUuid`

rakshith-ravi opened this issue · comments

It looks like error::InvalidUuid was written and well documented, but isn't exported. Is this intentional? Or was this not exported by mistake?

If I am using a wrapper around Uuid in my application, what's the right way to generate a uuid::Error?

Hi @rakshith-ravi 👋

uuid doesn't give you a way to generate its errors externally. This is to keep its API surface area small, and to give it the flexibility to change how those errors are constructed in the future. In your application you can define your own error type using a library like thiserror that wraps uuid's error but also includes other variants if you need to generate them.

Ahh, got it. Makes sense. Thank you!