prolly/prolly/
encoding.rs1use serde::{Deserialize, Serialize};
4
5pub const INIT_LEVEL: u8 = 0;
7
8pub const DEFAULT_HASH_SEED: u64 = 0;
10
11pub const DEFAULT_MIN_CHUNK_SIZE: usize = 4;
13
14pub const DEFAULT_MAX_CHUNK_SIZE: usize = 1024 * 1024;
16
17pub const DEFAULT_CHUNKING_FACTOR: u32 = 128;
19
20#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Default)]
22pub enum Encoding {
23 #[default]
24 Raw,
25 Cbor,
26 Json,
27 Custom(String),
28}
29
30#[cfg(test)]
31mod tests {
32 use super::*;
33
34 #[test]
35 fn test_encoding_default() {
36 let encoding = Encoding::default();
37 assert_eq!(encoding, Encoding::Raw);
38 }
39
40 #[test]
41 fn test_encoding_custom() {
42 let encoding = Encoding::Custom("protobuf".to_string());
43 assert_eq!(encoding, Encoding::Custom("protobuf".to_string()));
44 }
45
46 #[test]
47 fn test_constants() {
48 assert_eq!(INIT_LEVEL, 0);
49 assert_eq!(DEFAULT_HASH_SEED, 0);
50 assert_eq!(DEFAULT_MIN_CHUNK_SIZE, 4);
51 assert_eq!(DEFAULT_MAX_CHUNK_SIZE, 1024 * 1024);
52 assert_eq!(DEFAULT_CHUNKING_FACTOR, 128);
53 }
54}