mz_adapter_types/
timestamp_selection.rs1use serde::{Deserialize, Serialize};
11use std::default::Default;
12
13#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
15pub enum ConstraintBasedTimestampSelection {
16 Enabled,
17 Disabled,
18 Verify,
19}
20
21impl Default for ConstraintBasedTimestampSelection {
22 fn default() -> Self {
23 Self::Enabled
24 }
25}
26
27impl ConstraintBasedTimestampSelection {
28 pub const fn const_default() -> Self {
29 Self::Enabled
30 }
31
32 pub fn from_str(s: &str) -> Self {
33 match s {
34 "enabled" => Self::Enabled,
35 "disabled" => Self::Disabled,
36 "verify" => Self::Verify,
37 _ => {
38 tracing::error!("invalid value for ConstraintBasedTimestampSelection: {}", s);
39 ConstraintBasedTimestampSelection::default()
40 }
41 }
42 }
43
44 pub const fn as_str(&self) -> &'static str {
45 match self {
46 Self::Enabled => "enabled",
47 Self::Disabled => "disabled",
48 Self::Verify => "verify",
49 }
50 }
51}