Crates.io | mlua-crc16 |
lib.rs | mlua-crc16 |
version | 1.0.3 |
source | src |
created_at | 2023-10-07 13:36:53.682247 |
updated_at | 2024-10-29 13:17:13.488137 |
description | A Rust-native implementation of luarocks.org/modules/youlu/luacrc16 for mlua |
homepage | https://on-prem.net |
repository | https://gitlab.com/megalithic-llc/mlua-crc16.git |
max_upload_size | |
id | 996322 |
size | 7,676 |
A Rust-native implementation of luacrc16 for mlua.
Add to your Rust project using one of MLua's features: [lua51, lua52, lua53, lua54, luajit, luajit52].
$ cargo add mlua-crc16 --features luajit
use mlua::Lua;
let lua = Lua::new();
mlua_crc16::preload(&lua)?;
let script = r#"
local crc16 = require('crc16')
return crc16.compute('abc 123')
"#
let crc16: u16 = lua.load(script).eval()?;
assert_eq!(crc16, 0x8831_u16);
$ make check