mirror of
https://github.com/mlua-rs/mlua
synced 2026-06-08 16:05:43 +00:00
16 lines
387 B
Rust
16 lines
387 B
Rust
use mlua::{UserData, UserDataMethods};
|
|
|
|
fn main() {
|
|
#[derive(Clone)]
|
|
struct MyUserData<'a>(&'a i64);
|
|
|
|
impl UserData for MyUserData<'_> {
|
|
fn add_methods<M: UserDataMethods<Self>>(methods: &mut M) {
|
|
methods.add_async_method("print", |_, data, ()| async move {
|
|
println!("{}", data.0);
|
|
Ok(())
|
|
});
|
|
}
|
|
}
|
|
}
|