Binary Tuples
This is a small library for working with ordered binary tuples - and is designed to be compatible with the tuples implementation bundled with FoundationDB client libraries.
This library allows use of the following data types:
- Strings
- Binary arrays
- Numbers (
i64
,f32
,f64
) - Boolean values
- UUIDs
- Nested tuples (read supported - no api support for creation yet)
API
The easiest way to create tuples is using the exposed tuple!
macro:
extern crate binary_tuples;
let user_id = 1;
let value = tuple!;
// Returns as a byte array
let bytes = value.into_bytes;
Tuples can also be deserialised into a vector of tuple segments:
use ;
let tuple = from_bytes
.as_segments
.unwrap;
match tuple
Tuples can reused as efficient prefixes for other tuples
let users_tuple = tuple!;
let post_1 = tuple!;
let post_2 = tuple!;