-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The previous version of the code was using fetch_arg and return_result functions and because it had to return a Result<u64>, it also couldn't easily use a regular result with the error type we actually want to return - HTTPError in this case. The new code allows passing the host function as an argument to the wrap_async function, which in turn handles all of the heavy lifting of serializing and deserializing arguments and results The only downside is that now host functions have to return `Pin<Box<...>>`, but I'm OK with that as it doesn't complicate the code too much. A possible solution to allow returning a regular feature would be to create a helper trait, like pointed out in here: https://users.rust-lang.org/t/approaches-to-an-issue-with-higher-rank-trait-bounds-on-another-generic-type/81941/2, but I don't want to waste too much time on it at the moment. Another solution might be this crate: https://lib.rs/crates/higher-order-closure
- Loading branch information
Showing
3 changed files
with
99 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,6 @@ crate-type = ["cdylib"] | |
|
||
[dependencies] | ||
crows-bindings = { path = "../bindings" } | ||
|
||
[profile.release] | ||
lto = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters