This is a Rust version of MMKV. By default, this lib uses CRC8 to check data integrity.
If include feature encryption
, this lib will encrypt
the data with AES-EAX.
Add dependency:
cargo add mmkv
And use MMKV
directly:
```rust
use mmkv::MMKV;
fn main() { // initialize it with a directory, // the library will crate a file, // named "minimmkv" under this dir MMKV::initialize("."); MMKV::puti32("key1", 1); // Some(1) println!("{:?}", MMKV::geti32("key1")); MMKV::putstr("key1", "value"); // None, cause "key1" was override by putstr println!("{:?}", MMKV::geti32("key1")); // Some("value") println!("{:?}", MMKV::getstr("key1")); MMKV::putbool("key1", true); // Some(true) println!("{:?}", MMKV::get_bool("key1")); } ```
Add dependency:
cargo add mmkv --features encryption
Then init MMKV
with an encryption credential:
MMKV::initialize(".", "88C51C536176AD8A8EE4A06F62EE897E")
Encryption will greatly reduce the efficiency of reading and writing, and will also increase the file size, use at your own risk!