mirror of
https://github.com/lune-org/lune.git
synced 2025-05-04 10:43:57 +01:00
feat: since we have interior mut, remove &Crypto impl
This commit is contained in:
parent
3c2702b7f0
commit
12d23e7e1b
1 changed files with 4 additions and 9 deletions
|
@ -142,19 +142,14 @@ impl Crypto {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LuaUserData for &'static Crypto {
|
|
||||||
fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) {
|
|
||||||
methods.add_method(
|
|
||||||
"update",
|
|
||||||
|_, this, content: String| Ok(this.update(content)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl LuaUserData for Crypto {
|
impl LuaUserData for Crypto {
|
||||||
fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) {
|
fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) {
|
||||||
methods.add_method("digest", |_, this, encoding| {
|
methods.add_method("digest", |_, this, encoding| {
|
||||||
this.digest(encoding).map_err(mlua::Error::runtime)
|
this.digest(encoding).map_err(mlua::Error::runtime)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
methods.add_method("update", |_, this, content: String| {
|
||||||
|
Ok(this.update(content).clone())
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue