RFC - using library written in Rust

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

RFC - using library written in Rust

Post by mlampert »

Path uses clipper, and on top of that libarea and the usage has been challenging. On top of that the libraries are practically unmaintained. I meant to replace it with pure OCC but the behaviour of "makeOffset2D" makes this a no-go.

sliptonic has found the library CavalierContour (MIT license) which has a reasonable API and is wicked fast. The problem is that the author stopped working on the C++ implementation 6 years ago and re-implemented it in Rust. The Rust version is still under active development/maintained and seems to be used. It has C FFI so it could be integrated by FC and we could add a python shim on top of it.

The question is, how do we feel about adding a (build) dependency on a library written in Rust?
User avatar
sliptonic
Veteran
Posts: 3457
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: RFC - using library written in Rust

Post by sliptonic »

mlampert wrote: Wed Nov 23, 2022 8:09 pm wicked fast.
He even provides some nice benchmarks against clipper
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: RFC - using library written in Rust

Post by heda »

full disclaimer: i do not do c/c++, compilation, cmake, conda, (or rust for that matter) so have no real clue of what impact/implications could be if using a rustlib.

with that said: if you feel that it makes sense - please try - if nothing else, just to see if it can be made to work

why:
- it would be cool if there is a working example of rust code into fc tool chain
- rust has hit top 20 in tiobe index
- in my simplistic world view, py has gained traction because it is the simplest way to get something done, engineering floss seems to largely converge on c/c++ and py. however, if my understanding of rust is somewhat correct, it is somewhere in between c and py in ease to get things done. since imho easy ways to get things done tend to win with time, i think rust will take a piece of the engineering pie from c/c++ looking ahead, heck rust might prove to be simple enough that py people actually start using it to speed up python...
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: RFC - using library written in Rust

Post by wandererfan »

mlampert wrote: Wed Nov 23, 2022 8:09 pm The question is, how do we feel about adding a (build) dependency on a library written in Rust?
If the library is being maintained elsewhere, and looks to continue being maintained there, then the language it is written in becomes irrelevant. If it looks like we might have to become the library maintainers, then Rust is an issue.

The only point of concern is the interface code. If that is stable and straight-forward, or even better if it can be contributed back to the library maintainers, then there shouldn't be any issue about the language.
Post Reply