Skip to main content

reallyme_foundationdb_kit/fdb/
tuple.rs

1// SPDX-FileCopyrightText: 2026 ReallyMe LLC
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4//! FoundationDB tuple encoding boundary.
5
6use bytes::Bytes;
7
8pub use foundationdb::tuple::{
9    Element, Subspace, TuplePack, Versionstamp, pack, pack_with_versionstamp, unpack,
10};
11
12/// Encodes tuple values into a `Bytes` key buffer.
13///
14/// This avoids forcing downstream call sites to keep converting from `Vec<u8>`
15/// when the surrounding key pipeline is already `Bytes`-oriented.
16pub fn pack_bytes<T: TuplePack>(value: &T) -> Bytes {
17    Bytes::from(pack(value))
18}
19
20#[cfg(test)]
21#[path = "tuple_tests.rs"]
22mod tests;