liquid_cache_common/
lib.rs1#![doc = include_str!(concat!("../", std::env!("CARGO_PKG_README")))]
2
3use std::fmt::Display;
4use std::str::FromStr;
5pub mod rpc;
6pub mod utils;
7
8#[derive(Clone, Debug, Default, Copy, PartialEq, Eq)]
10pub enum CacheMode {
11 Parquet,
13 #[default]
15 Liquid,
16 LiquidEagerTranscode,
18 Arrow,
20}
21
22impl Display for CacheMode {
23 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24 write!(
25 f,
26 "{}",
27 match self {
28 CacheMode::Parquet => "parquet",
29 CacheMode::Liquid => "liquid",
30 CacheMode::LiquidEagerTranscode => "liquid_eager_transcode",
31 CacheMode::Arrow => "arrow",
32 }
33 )
34 }
35}
36
37impl FromStr for CacheMode {
38 type Err = String;
39
40 fn from_str(s: &str) -> Result<Self, Self::Err> {
41 Ok(match s {
42 "parquet" => CacheMode::Parquet,
43 "liquid" => CacheMode::Liquid,
44 "liquid_eager_transcode" => CacheMode::LiquidEagerTranscode,
45 "arrow" => CacheMode::Arrow,
46 _ => {
47 return Err(format!(
48 "Invalid cache mode: {}, must be one of: parquet, liquid, liquid_eager_transcode, arrow",
49 s
50 ));
51 }
52 })
53 }
54}