paypal_rust/resources/enums/
category.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
4pub enum Category {
5 #[serde(rename = "DIGITAL_GOODS")]
6 DigitalGoods,
7 #[serde(rename = "PHYSICAL_GOODS")]
8 PhysicalGoods,
9 #[serde(rename = "DONATION")]
10 Donation,
11}
12
13impl Category {
14 pub const fn as_str(self) -> &'static str {
15 match self {
16 Self::DigitalGoods => "DIGITAL_GOODS",
17 Self::PhysicalGoods => "PHYSICAL_GOODS",
18 Self::Donation => "DONATION",
19 }
20 }
21}
22
23impl AsRef<str> for Category {
24 fn as_ref(&self) -> &str {
25 self.as_str()
26 }
27}
28
29impl std::fmt::Display for Category {
30 fn fmt(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
31 self.as_str().fmt(formatter)
32 }
33}