Open DSchroer opened 1 year ago
This sounds reasonable to me!
I hadn't put much thought into organization as you can probably tell, my original goal was to just get this working on the bottle tutorial and get a feel for how to bind to C++ code.
You're right to be thinking about better organization now though so it doesn't become a pain.
Maybe the best way to start is to apply what you've suggested to one of the opencascade types and open a PR so we can get a feel for how it'll look.
Eventually I want to make a much higher level layer on top of all this, but it will be very helpful to more easily bind to the lower level stuff with your suggestions.
Currently the naming of methods and functions in lib.rs is inconsistent:
type_name
HandleGeomCurve_Value
DynamicType
Proposal:
Naming
Always use the Opencascade convention for C++. (
CammelCase
with no_
, including standalone functions). Not the rust convention.Since
cxx
has no better way yet, use_
to show associated types for functions that cant be bound usingself
. This covers constructors and other similar functions.In
lib.rs
, since it is in rust, we always use rust naming conventions and make use of thecxx_name
attribute to point to the correctc++
method.Access
Free floating functions are hard to reason about. Since Opencascade is a class based library, we should follow the same by re-attaching methods to the respective parent. If a function is associated with a type it should be private and attached via an impl block to the associated type.
What do you think? I feel this will be a good step forward and help reason about how future additions to the
-sys
crate should be made.