alexxbb / hapi-rs

Idiomatic Rust bindings to Houdini Engine C API
MIT License
64 stars 7 forks source link

Make naming canonical #6

Closed virtualritz closed 1 year ago

virtualritz commented 2 years ago

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.

alexxbb commented 2 years ago

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.

virtualritz commented 2 years ago

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. 😁