feat: since we have interior mut, remove &Crypto impl

This commit is contained in:
Erica Marigold 2023-10-15 00:27:54 -07:00
parent 3c2702b7f0
commit 12d23e7e1b
No known key found for this signature in database
GPG key ID: 2768CC0C23D245D1

View file

@ -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 {
fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) {
methods.add_method("digest", |_, this, encoding| {
this.digest(encoding).map_err(mlua::Error::runtime)
});
methods.add_method("update", |_, this, content: String| {
Ok(this.update(content).clone())
});
}
}