-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add support for Auto Splitting to the c api. #355
Conversation
The trait helps ensure a consistent API between platforms, with the struct methods delegating to the trait implementations.
With this (and a local api change) my portal autosplitter works without changes.
This is a prelude for having helper processes transfer this fd to the main process.
This may be a bit of a heavyweight solution, lmk and I'll revert this commit.
capi/Cargo.toml
Outdated
@@ -5,7 +5,7 @@ authors = ["Christopher Serr <[email protected]>"] | |||
edition = "2018" | |||
|
|||
[dependencies] | |||
livesplit-core = { path = "..", default-features = false, features = ["std"] } | |||
livesplit-core = { path = "..", default-features = false, features = ["std", "auto-splitting"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the reason why I didn't pull it in yet. The problem is that unconditionally depending on auto splitting will break for example the web version. So this needs to be an optional feature. However at least atm we don't support features in the binding generator. So either the C API needs to stub out the implementation or we need to improve our binding generator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the feature attribute to everything now, but I still need to work on improving the bindings generator.
That might take me a while since I'm not familiar at all with syn
and binding generator's code is a bit messy.
6cf198a
to
8e10561
Compare
The only thing really blocking this right now is the fact that we yet to improve the bindings generator. (All of the needed feature attributes have been set up.) I've tried doing it myself but If you'd rather take a crack at it yourself, we are going to need some sort of Edit: We should also probably handle logging but that's going to need further discussion. |
I'm going to opt to just stub out the implementation here instead of extending the bindings generator, using this as an example. We can improve the bindings generator at a later date. |
413a24b
to
d868c17
Compare
This works in its current state but some stuff needs to be adjusted.
Todo:
Find a way to expose logging as right now logging just does not work.
Find a way to make auto splitting support optional.
Improve bindings generator to conditionally include definitions for the auto splitting feature.Stubbed out functions instead.