mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-24 18:02:47 +08:00
feat(ios,android): setup uniffi infra (#8828)
This commit is contained in:
19
packages/frontend/mobile-native/Cargo.toml
Normal file
19
packages/frontend/mobile-native/Cargo.toml
Normal file
@@ -0,0 +1,19 @@
|
||||
[package]
|
||||
edition = "2021"
|
||||
name = "affine_mobile_native"
|
||||
version = "0.0.0"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "staticlib"]
|
||||
|
||||
[[bin]]
|
||||
# This can be whatever name makes sense for your project, but the rest of this tutorial assumes uniffi-bindgen.
|
||||
name = "uniffi-bindgen"
|
||||
path = "uniffi-bindgen.rs"
|
||||
|
||||
[dependencies]
|
||||
affine_common = { workspace = true }
|
||||
uniffi = { version = "0.28", features = ["cli"] }
|
||||
|
||||
[build-dependencies]
|
||||
uniffi = { version = "0.28", features = ["build"] }
|
||||
8
packages/frontend/mobile-native/src/lib.rs
Normal file
8
packages/frontend/mobile-native/src/lib.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
use affine_common::hashcash::Stamp;
|
||||
|
||||
uniffi::setup_scaffolding!("affine_mobile_native");
|
||||
|
||||
#[uniffi::export]
|
||||
pub fn hashcash_mint(resource: String, bits: u32) -> String {
|
||||
Stamp::mint(resource, Some(bits)).format()
|
||||
}
|
||||
3
packages/frontend/mobile-native/uniffi-bindgen.rs
Normal file
3
packages/frontend/mobile-native/uniffi-bindgen.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
uniffi::uniffi_bindgen_main()
|
||||
}
|
||||
Reference in New Issue
Block a user