Open MiSawa opened 4 years ago
In my opinion, we should modify the API if it makes codes more Rust-friendly, because:
However we need a working version of the library. The earlier, the better. Porting would be delayed if we were too sticky to make it Rust-friendly.
So my opinion:
int
-> usize
, empty()
-> is_empty()
, renaming variables and functions to meaningful names, etc. You can change interface if you think it's better, e.g. using ranges instead of start
, end
pair.
There are two very different way of choosing how to port the original C++ library;
For example, there are a lot of
int
s used as indexingvector
s in the original C++ implementation. If it had been implemented in Rust from the beginning, it would have beenusize
. Another example would be method name, likefn empty() -> bool
. While it is very common in C++ to name such a methodempty
, all such methods in Rust that I know of are namedis_empty
.Having a guideline would help make this kind of implementation choosing consistent across modules as well as code reviewers.