bindb/storage/dynamic/header.rs
1use std::marker::PhantomData;
2
3binbuf::fixed! {
4 #[derive(Clone, Debug)]
5 pub struct Value {
6 #[lens(pub buf_len)]
7 pub len: u64, // count of items in collection
8 #[lens(pub buf_bytes_len)]
9 pub bytes_len: u64, // how many bytes taken by storing items in collection (only items, not header)
10 }
11
12 buf! { pub struct Buf<P>(Value, P); }
13
14 impl I for Value {
15 type Buf<P> = Buf<P>;
16 }
17
18 impl Encode for Value {}
19 impl Decode for Value {}
20}
21
22impl Value {
23 pub fn new(len: u64, bytes_len: u64) -> Self {
24 Self { len, bytes_len }
25 }
26}