made_core/value_objects/delivery/
follow_replacement.rs1use std::fmt;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(
11 Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize,
12)]
13#[serde(rename_all = "snake_case")]
14pub enum FollowReplacement {
15 #[default]
17 Stay,
18 Follow,
20}
21
22impl FollowReplacement {
23 #[must_use]
24 pub const fn follows(self) -> bool {
25 matches!(self, Self::Follow)
26 }
27
28 #[must_use]
29 pub const fn as_str(self) -> &'static str {
30 match self {
31 Self::Stay => "stay",
32 Self::Follow => "follow",
33 }
34 }
35}
36
37impl fmt::Display for FollowReplacement {
38 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
39 formatter.write_str(self.as_str())
40 }
41}