hapi-rs icon indicating copy to clipboard operation
hapi-rs copied to clipboard

Make naming canonical

Open virtualritz opened this issue 3 years ago • 2 comments
trafficstars

From the official Rust naming guidelines:

Crate names should not use -rs or -rust as a suffix or prefix. Every crate is Rust! It serves no purpose to remind users of this constantly.

All getters should have the get_ prefix removed.

With a few exceptions, the aget_ prefix is not used for getters in Rust code.

There may be more. These are just what I saw immediately when skimming the docs.

Edit: it looks like most of the crate already does that. I just saw parameter::get_value() when skimming the docs so I wrongly assumed this was used everywhere.

virtualritz avatar Mar 18 '22 09:03 virtualritz

Hey @virtualritz

I'm planing to do some API polishing and make sure to remove all _gets and _sets where it makes sense. Regarding the -rs naming, while it's true for pure Rust crates, there are numerous of crates that bind to other C/C++ APIs and community seems to stick to -sys for raw bindings and -rs for idiomatic Rust. But I don't mind to rename it at some point either.

Cheers.

alexxbb avatar Mar 18 '22 18:03 alexxbb

Cool. -sys is correct for RAW binding crates. But -rs for anything, including hand written, canonical Rust APIs over -sys crates is not.

My guess is that the authors of the other crates either didn't know about the API guidelines or ignored them intentionally.

I didn't know about this until my second year of Rust and had already written some wrappers by then. So I fell for this myself. 😁

virtualritz avatar Mar 24 '22 09:03 virtualritz