https://github.com/korewachino/mempickle
https://github.com/korewachino/mempickle
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/korewachino/mempickle
- Owner: korewaChino
- Created: 2023-12-04T10:40:04.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-04T10:40:16.000Z (over 1 year ago)
- Last Synced: 2025-02-10T09:05:31.932Z (4 months ago)
- Language: Rust
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mempickle
> :warning: **WARNING**: This crate should **NEVER** be used in production environments. All your data will be corrupted if you EVER change your code, or even recompile it with a different compiler version. This crate is only meant for learning purposes.
This crate provides a `MemPickle` type that can pickle raw Rust structs into a byte buffer and unpickle them back.
I wrote this crate just to learn how to work with raw pointers in Rust. If you insist on using it, it's your funeral.
Load with feature "i_like_breaking_production" if you insist on using this crate.
## Usage
```rust
use mempickle::MemPickle;#[derive(Debug, PartialEq)]
struct Foo {
a: u32,
b: u32,
}let foo = Foo { a: 42, b: 69 };
let pickle = MemPickle::new(foo);
// do some other stuff until you need to load the pickle back
let foo = pickle.unwrap();
assert_eq!(foo, Foo { a: 42, b: 69 });
```