-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Suggestion] FFI for Rust #3
Comments
Yes, by all means let's add such a wrapper to clockkit. Just to get things rolling, for now those lower-level exceptions might just be ignored, in the venerable tradition of "if you can't handle an error condition, don't test for it." |
Everything's been implemented for a while now. |
Hello,
currently I'm using clockkit in a project which I wrote in Rust. SWIG is not supporting Rust at the moment. To use it, I made a temporary FFI which works fine as long as there are no exceptions thrown (Rust doesn't have those). For now that is fine in my case. But in order to make it useful for others too, I wouldn'd mind doing things properly. Before investing the time though, I wanted to ask whether you would be willing to include the wrapper file in clockkit (and probably answer some questions so the interface ends up sensible).
My two main concerns here are:
1.1 In order to create a
PhaseLockedClock
with a configuration file for which one does not need root access, I exposed the corresponding method inConfigReader
.1.2 To handle the lifetime properly I made a clock an object like it is in C++ too.
1.3 Methods currently exposed are:
is_synchronized()
get_offset()
get_value()
(raw timesstamp as integer)DateTime
value as a timestampTo indicate various state changes, the Rust methods would return
Result
s with enum instances corresponding to the exceptions, e.g.clockkit::error::Error::OutOfSync
. The candidates I have identified so far are:-
OutOfSync
-
Timeout
-
PacketError
As this will be a high level interface I am unsure about the value of "lower level" exceptions like the performance counter frequency error or a clock rollover.
In addition to that, I would probably provide a patch to move the printing of the configuration in
ConfigReader
to a method. That method could be called inclockkit.cpp
so the output would not change, yet the exposed FFI would not print anything when creating a clock as part of another project.I would appreciate to hear your feedback on this; and hope that, with another easy interface to this cool project, more people will be able to make use of it.
The text was updated successfully, but these errors were encountered: