datafusion_cli/
pool_type.rs1use std::{
6 fmt::{self, Display, Formatter},
7 str::FromStr,
8};
9
10#[derive(PartialEq, Debug, Clone)]
11pub enum PoolType {
12 Greedy,
13 Fair,
14}
15
16impl FromStr for PoolType {
17 type Err = String;
18
19 fn from_str(s: &str) -> Result<Self, Self::Err> {
20 match s {
21 "Greedy" | "greedy" => Ok(PoolType::Greedy),
22 "Fair" | "fair" => Ok(PoolType::Fair),
23 _ => Err(format!("Invalid memory pool type '{s}'")),
24 }
25 }
26}
27
28impl Display for PoolType {
29 fn fmt(&self, f: &mut Formatter) -> fmt::Result {
30 match self {
31 PoolType::Greedy => write!(f, "greedy"),
32 PoolType::Fair => write!(f, "fair"),
33 }
34 }
35}