Function fdb_tuple::from_bytes

source ·
pub fn from_bytes<T>(bytes: &[u8]) -> Result<T, Error>where
    T: FromBytes,
Expand description

Converts a byte vector to a value.

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()));