# 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: ```rust #[macro_use] extern crate binary_tuples; let user_id = 1; let value = tuple!("users", user_id, "posts"); // Returns as a byte array let bytes = value.into_bytes(); ``` Tuples can also be deserialised into a vector of tuple segments: ```rust use binary_tuples::{Tuple, segment::Segment}; let tuple = Tuple::from_bytes(...) .as_segments() .unwrap(); match tuple[0] { Segment::String(value) => println!("{}", value), _ => println!("Other data type") } ``` Tuples can reused as efficient prefixes for other tuples ```rust let users_tuple = tuple!("users", user_id, "posts"); let post_1 = tuple!(users_tuple, post_id_1); let post_2 = tuple!(users_tuple, post_id_2); ```