Function fdb_tuple::to_bytes

source ·
pub fn to_bytes<T: ToBytes>(value: T) -> Vec<u8>
Expand description

Converts a value to a tuple-encoded byte vector.

Examples

use fdb_tuple::{to_bytes, from_bytes};

let bytes = to_bytes(("a", "b"));
assert_eq!(bytes, b"\x02a\x00\x02b\x00");

let tuple: (String, String) = from_bytes(&bytes).unwrap();
assert_eq!(tuple, ("a".to_string(), "b".to_string()));