Skip to main content

reifydb_value/value/
enum_variant.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2026 ReifyDB
3
4use std::fmt::{self, Display, Formatter};
5
6use serde::{Deserialize, Serialize};
7
8#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
9pub struct EnumVariant {
10	pub r#enum: String,
11	pub variant: String,
12}
13
14impl EnumVariant {
15	pub fn new(r#enum: impl Into<String>, variant: impl Into<String>) -> Self {
16		Self {
17			r#enum: r#enum.into(),
18			variant: variant.into(),
19		}
20	}
21}
22
23impl Display for EnumVariant {
24	fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
25		f.write_str(&self.variant)
26	}
27}