[][src]Function kvds::encode_to_file

pub fn encode_to_file(
    name: &str,
    data: Vec<(u8, Vec<u8>)>
) -> Result<(), EncodeToFileError>

Encodes a key-value list to a file.

Example

let data = vec![
    (1, "Hello".as_bytes().to_vec()),
    (2, ", ".as_bytes().to_vec()),
    (4, "world".as_bytes().to_vec()),
    (1, "!".as_bytes().to_vec()),
];

kvds::encode_to_file("data", data)?;

Errors

This function returns an error if something goes wrong with creating or writing to a file, or an error occurs in encoding the data.