11 11 | ///
|
12 12 | /// ```text
|
13 13 | /// # let computeobjectchecksumalgorithm = unimplemented!();
|
14 14 | /// match computeobjectchecksumalgorithm {
|
15 15 | /// ComputeObjectChecksumAlgorithm::Crc32 => { /* ... */ },
|
16 16 | /// ComputeObjectChecksumAlgorithm::Crc32C => { /* ... */ },
|
17 17 | /// ComputeObjectChecksumAlgorithm::Crc64Nvme => { /* ... */ },
|
18 18 | /// ComputeObjectChecksumAlgorithm::Md5 => { /* ... */ },
|
19 19 | /// ComputeObjectChecksumAlgorithm::Sha1 => { /* ... */ },
|
20 20 | /// ComputeObjectChecksumAlgorithm::Sha256 => { /* ... */ },
|
21 + | /// ComputeObjectChecksumAlgorithm::Sha512 => { /* ... */ },
|
22 + | /// ComputeObjectChecksumAlgorithm::Xxhash128 => { /* ... */ },
|
23 + | /// ComputeObjectChecksumAlgorithm::Xxhash3 => { /* ... */ },
|
24 + | /// ComputeObjectChecksumAlgorithm::Xxhash64 => { /* ... */ },
|
21 25 | /// other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
|
22 26 | /// _ => { /* ... */ },
|
23 27 | /// }
|
24 28 | /// ```
|
25 29 | /// The above code demonstrates that when `computeobjectchecksumalgorithm` represents
|
26 30 | /// `NewFeature`, the execution path will lead to the second last match arm,
|
27 31 | /// even though the enum does not contain a variant `ComputeObjectChecksumAlgorithm::NewFeature`
|
28 32 | /// in the current version of SDK. The reason is that the variable `other`,
|
29 33 | /// created by the `@` operator, is bound to
|
30 34 | /// `ComputeObjectChecksumAlgorithm::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
|
31 35 | /// and calling `as_str` on it yields `"NewFeature"`.
|
32 36 | /// This match expression is forward-compatible when executed with a newer
|
33 37 | /// version of SDK where the variant `ComputeObjectChecksumAlgorithm::NewFeature` is defined.
|
34 38 | /// Specifically, when `computeobjectchecksumalgorithm` represents `NewFeature`,
|
35 39 | /// the execution path will hit the second last match arm as before by virtue of
|
36 40 | /// calling `as_str` on `ComputeObjectChecksumAlgorithm::NewFeature` also yielding `"NewFeature"`.
|
37 41 | ///
|
38 42 | /// Explicitly matching on the `Unknown` variant should
|
39 43 | /// be avoided for two reasons:
|
40 44 | /// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
|
41 45 | /// - It might inadvertently shadow other intended match arms.
|
42 46 | ///
|
43 47 | #[allow(missing_docs)] // documentation missing in model
|
44 48 | #[non_exhaustive]
|
45 49 | #[derive(
|
46 50 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
|
47 51 | )]
|
48 52 | pub enum ComputeObjectChecksumAlgorithm {
|
49 53 | #[allow(missing_docs)] // documentation missing in model
|
50 54 | Crc32,
|
51 55 | #[allow(missing_docs)] // documentation missing in model
|
52 56 | Crc32C,
|
53 57 | #[allow(missing_docs)] // documentation missing in model
|
54 58 | Crc64Nvme,
|
55 59 | #[allow(missing_docs)] // documentation missing in model
|
56 60 | Md5,
|
57 61 | #[allow(missing_docs)] // documentation missing in model
|
58 62 | Sha1,
|
59 63 | #[allow(missing_docs)] // documentation missing in model
|
60 64 | Sha256,
|
65 + | #[allow(missing_docs)] // documentation missing in model
|
66 + | Sha512,
|
67 + | #[allow(missing_docs)] // documentation missing in model
|
68 + | Xxhash128,
|
69 + | #[allow(missing_docs)] // documentation missing in model
|
70 + | Xxhash3,
|
71 + | #[allow(missing_docs)] // documentation missing in model
|
72 + | Xxhash64,
|
61 73 | /// `Unknown` contains new variants that have been added since this code was generated.
|
62 74 | #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
|
63 75 | Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
|
64 76 | }
|
65 77 | impl ::std::convert::From<&str> for ComputeObjectChecksumAlgorithm {
|
66 78 | fn from(s: &str) -> Self {
|
67 79 | match s {
|
68 80 | "CRC32" => ComputeObjectChecksumAlgorithm::Crc32,
|
69 81 | "CRC32C" => ComputeObjectChecksumAlgorithm::Crc32C,
|
70 82 | "CRC64NVME" => ComputeObjectChecksumAlgorithm::Crc64Nvme,
|
71 83 | "MD5" => ComputeObjectChecksumAlgorithm::Md5,
|
72 84 | "SHA1" => ComputeObjectChecksumAlgorithm::Sha1,
|
73 85 | "SHA256" => ComputeObjectChecksumAlgorithm::Sha256,
|
86 + | "SHA512" => ComputeObjectChecksumAlgorithm::Sha512,
|
87 + | "XXHASH128" => ComputeObjectChecksumAlgorithm::Xxhash128,
|
88 + | "XXHASH3" => ComputeObjectChecksumAlgorithm::Xxhash3,
|
89 + | "XXHASH64" => ComputeObjectChecksumAlgorithm::Xxhash64,
|
74 90 | other => ComputeObjectChecksumAlgorithm::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
|
75 91 | }
|
76 92 | }
|
77 93 | }
|
78 94 | impl ::std::str::FromStr for ComputeObjectChecksumAlgorithm {
|
79 95 | type Err = ::std::convert::Infallible;
|
80 96 |
|
81 97 | fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
|
82 98 | ::std::result::Result::Ok(ComputeObjectChecksumAlgorithm::from(s))
|
83 99 | }
|
84 100 | }
|
85 101 | impl ComputeObjectChecksumAlgorithm {
|
86 102 | /// Returns the `&str` value of the enum member.
|
87 103 | pub fn as_str(&self) -> &str {
|
88 104 | match self {
|
89 105 | ComputeObjectChecksumAlgorithm::Crc32 => "CRC32",
|
90 106 | ComputeObjectChecksumAlgorithm::Crc32C => "CRC32C",
|
91 107 | ComputeObjectChecksumAlgorithm::Crc64Nvme => "CRC64NVME",
|
92 108 | ComputeObjectChecksumAlgorithm::Md5 => "MD5",
|
93 109 | ComputeObjectChecksumAlgorithm::Sha1 => "SHA1",
|
94 110 | ComputeObjectChecksumAlgorithm::Sha256 => "SHA256",
|
111 + | ComputeObjectChecksumAlgorithm::Sha512 => "SHA512",
|
112 + | ComputeObjectChecksumAlgorithm::Xxhash128 => "XXHASH128",
|
113 + | ComputeObjectChecksumAlgorithm::Xxhash3 => "XXHASH3",
|
114 + | ComputeObjectChecksumAlgorithm::Xxhash64 => "XXHASH64",
|
95 115 | ComputeObjectChecksumAlgorithm::Unknown(value) => value.as_str(),
|
96 116 | }
|
97 117 | }
|
98 118 | /// Returns all the `&str` representations of the enum members.
|
99 119 | pub const fn values() -> &'static [&'static str] {
|
100 - | &["CRC32", "CRC32C", "CRC64NVME", "MD5", "SHA1", "SHA256"]
|
120 + | &[
|
121 + | "CRC32",
|
122 + | "CRC32C",
|
123 + | "CRC64NVME",
|
124 + | "MD5",
|
125 + | "SHA1",
|
126 + | "SHA256",
|
127 + | "SHA512",
|
128 + | "XXHASH128",
|
129 + | "XXHASH3",
|
130 + | "XXHASH64",
|
131 + | ]
|
101 132 | }
|
102 133 | }
|
103 134 | impl ::std::convert::AsRef<str> for ComputeObjectChecksumAlgorithm {
|
104 135 | fn as_ref(&self) -> &str {
|
105 136 | self.as_str()
|
106 137 | }
|
107 138 | }
|
108 139 | impl ComputeObjectChecksumAlgorithm {
|
109 140 | /// Parses the enum value while disallowing unknown variants.
|
110 141 | ///
|
111 142 | /// Unknown variants will result in an error.
|
112 143 | pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
|
113 144 | match Self::from(value) {
|
114 145 | #[allow(deprecated)]
|
115 146 | Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
|
116 147 | known => Ok(known),
|
117 148 | }
|
118 149 | }
|
119 150 | }
|
120 151 | impl ::std::fmt::Display for ComputeObjectChecksumAlgorithm {
|
121 152 | fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
122 153 | match self {
|
123 154 | ComputeObjectChecksumAlgorithm::Crc32 => write!(f, "CRC32"),
|
124 155 | ComputeObjectChecksumAlgorithm::Crc32C => write!(f, "CRC32C"),
|
125 156 | ComputeObjectChecksumAlgorithm::Crc64Nvme => write!(f, "CRC64NVME"),
|
126 157 | ComputeObjectChecksumAlgorithm::Md5 => write!(f, "MD5"),
|
127 158 | ComputeObjectChecksumAlgorithm::Sha1 => write!(f, "SHA1"),
|
128 159 | ComputeObjectChecksumAlgorithm::Sha256 => write!(f, "SHA256"),
|
160 + | ComputeObjectChecksumAlgorithm::Sha512 => write!(f, "SHA512"),
|
161 + | ComputeObjectChecksumAlgorithm::Xxhash128 => write!(f, "XXHASH128"),
|
162 + | ComputeObjectChecksumAlgorithm::Xxhash3 => write!(f, "XXHASH3"),
|
163 + | ComputeObjectChecksumAlgorithm::Xxhash64 => write!(f, "XXHASH64"),
|
129 164 | ComputeObjectChecksumAlgorithm::Unknown(value) => write!(f, "{value}"),
|
130 165 | }
|
131 166 | }
|
132 167 | }
|