-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
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.
type_name(...) -> TypeName(...)
- 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.
HandleGeomCurve_Value
- 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.
#[cxx_name = "Shape"]
pub fn shape(self: Pin<&mut BRepAlgoAPI_Fuse>) -> &TopoDS_Shape;
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.
...
type StlAPI_Writer;
fn StlAPI_Writer_ctor() -> UniquePtr<StlAPI_Writer>;
}
}
...
impl ffi::StlAPI_Writer {
pub fn new() -> cxx::UniquePtr<ffi::StlAPI_Writer> {
ffi::StlAPI_Writer_ctor()
}
}
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.
Metadata
Metadata
Assignees
Labels
No labels