realm-codec
Parser and writer for Realm binary database files (format version 9).
Read an existing .realm file without the Realm SDK. Write a new .realm file from Rust data.
Reading
use RealmFile;
let realm = open?;
if let Some = realm.table
Writing
use ;
let mut builder = new;
builder
.table
.column
.column
.column
.row;
builder.write?;
// or: let bytes = builder.to_bytes();
Supported column types
| Realm type | Value variant |
Read | Write |
|---|---|---|---|
| Int | Value::Int |
✓ | ✓ |
| Bool | Value::Bool |
✓ | ✓ |
| String | Value::String |
✓ | ✓ |
| Data | Value::String |
✓ | ✓ |
| Float | Value::Float |
✓ | ✓ |
| Double | Value::Float |
✓ | ✓ |
| Timestamp | Value::Timestamp |
✓ | ✓ |
| Link | Value::Link |
✓ | ✓ |
Features
- Zero dependencies
- Parses Realm v9 format: NodeHeader, Group, spec arrays, full B-tree column traversal
- Writes valid Realm v9 files readable by the Realm SDK and this crate
- Round-trip tested:
RealmBuilder → to_bytes() → RealmFile::from_bytes()
License
MIT OR Apache-2.0