mz_repr/
cluster_replica_size_id.rs1use std::fmt;
11
12#[cfg(any(test, feature = "proptest"))]
13use proptest_derive::Arbitrary;
14use serde::{Deserialize, Serialize};
15
16#[derive(
20 Clone,
21 Copy,
22 Debug,
23 Eq,
24 PartialEq,
25 Ord,
26 PartialOrd,
27 Hash,
28 Serialize,
29 Deserialize
30)]
31#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
32pub enum ClusterReplicaSizeId {
33 System(u64),
34 User(u64),
35}
36
37impl ClusterReplicaSizeId {
38 pub fn is_system(&self) -> bool {
39 matches!(self, Self::System(_))
40 }
41}
42
43impl fmt::Display for ClusterReplicaSizeId {
44 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
45 match self {
46 Self::System(id) => write!(f, "s{id}"),
47 Self::User(id) => write!(f, "u{id}"),
48 }
49 }
50}