async thru dylib

This commit is contained in:
Andy Killorin 2024-12-18 23:22:35 -05:00
commit bf8a1ad8ed
Signed by: ank
GPG key ID: 23F9463ECB67FE8C
4 changed files with 417 additions and 0 deletions

1
loaded/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

7
loaded/Cargo.lock generated Normal file
View 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
View 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
View 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 {
}