async thru dylib
This commit is contained in:
commit
bf8a1ad8ed
4 changed files with 417 additions and 0 deletions
1
loaded/.gitignore
vendored
Normal file
1
loaded/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/target
|
||||
7
loaded/Cargo.lock
generated
Normal file
7
loaded/Cargo.lock
generated
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "loaded"
|
||||
version = "0.1.0"
|
||||
9
loaded/Cargo.toml
Normal file
9
loaded/Cargo.toml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[lib]
|
||||
crate-type = ["dylib"]
|
||||
|
||||
[package]
|
||||
name = "loaded"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
14
loaded/src/lib.rs
Normal file
14
loaded/src/lib.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
use std::{future::Future, pin::Pin};
|
||||
|
||||
pub async fn add(left: u64, right: u64) -> u64 {
|
||||
left + right
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn add_wrapper(left: u64, right: u64) -> Pin<Box<dyn Future<Output = u64>>> {
|
||||
Box::pin(add(left,right))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
}
|
||||
Loading…
Reference in a new issue