Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API naming #465

Closed
kinggoesgaming opened this issue Mar 11, 2020 · 1 comment
Closed

API naming #465

kinggoesgaming opened this issue Mar 11, 2020 · 1 comment

Comments

@kinggoesgaming
Copy link
Member

kinggoesgaming commented Mar 11, 2020

Based on #461 ny @DianaNites


API I naming is kind of weird and inconsistent, Uuid is Copy but Uuid::as_bytes exists? Why not Uuid::into_bytes, theres no Uuid::as_mut_bytes anyway? This also matches the Rust API Guidelines C-CONV.

@KodrAus
Copy link
Member

KodrAus commented Oct 28, 2021

We end up calling this as_bytes because it takes self by reference and returns a reference with the same lifetime. It's a free conversion. If we were taking self by-value and producing a by-value result then we'd use into_bytes. There isn't any as_mut_bytes because Uuid is immutable (it's a bit of a footgun to have mutable methods on Copy types).

So I think the current naming we've got is ok here.

@KodrAus KodrAus closed this as completed Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants