fix: handle buffers in compress_decompress too

This commit is contained in:
Erica Marigold 2024-04-20 14:21:09 +05:30
parent 89d66a93de
commit ef4fe6e1eb
No known key found for this signature in database
GPG key ID: 2768CC0C23D245D1

View file

@ -36,16 +36,16 @@ fn serde_decode<'lua>(
async fn serde_compress<'lua>(
lua: &'lua Lua,
(format, str): (CompressDecompressFormat, LuaString<'lua>),
) -> LuaResult<LuaString<'lua>> {
(format, str): (CompressDecompressFormat, BString),
) -> LuaResult<LuaAnyUserData<'lua>> {
let bytes = compress(format, str).await?;
lua.create_string(bytes)
lua.create_buffer(bytes)
}
async fn serde_decompress<'lua>(
lua: &'lua Lua,
(format, str): (CompressDecompressFormat, LuaString<'lua>),
) -> LuaResult<LuaString<'lua>> {
(format, str): (CompressDecompressFormat, BString),
) -> LuaResult<LuaAnyUserData<'lua>> {
let bytes = decompress(format, str).await?;
lua.create_string(bytes)
lua.create_buffer(bytes)
}