Skip to main content

nominal_api_conjure/conjure/objects/ingest/api/
upload_destination.rs

1#![allow(deprecated)]
2use std::fmt;
3use std::str;
4/// The object-storage destination an upload should be written to.
5#[derive(
6    Debug,
7    Clone,
8    PartialEq,
9    Eq,
10    PartialOrd,
11    Ord,
12    Hash,
13    conjure_object::serde::Deserialize,
14    conjure_object::serde::Serialize,
15)]
16#[serde(crate = "conjure_object::serde")]
17pub enum UploadDestination {
18    #[serde(rename = "UPLOADS")]
19    Uploads,
20    #[serde(rename = "FILE_STORE")]
21    FileStore,
22    /// An unknown variant.
23    #[serde(untagged)]
24    Unknown(Unknown),
25}
26impl UploadDestination {
27    /// Returns the string representation of the enum.
28    #[inline]
29    pub fn as_str(&self) -> &str {
30        match self {
31            UploadDestination::Uploads => "UPLOADS",
32            UploadDestination::FileStore => "FILE_STORE",
33            UploadDestination::Unknown(v) => &*v,
34        }
35    }
36}
37impl fmt::Display for UploadDestination {
38    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
39        fmt::Display::fmt(self.as_str(), fmt)
40    }
41}
42impl conjure_object::Plain for UploadDestination {
43    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
44        conjure_object::Plain::fmt(self.as_str(), fmt)
45    }
46}
47impl str::FromStr for UploadDestination {
48    type Err = conjure_object::plain::ParseEnumError;
49    #[inline]
50    fn from_str(
51        v: &str,
52    ) -> Result<UploadDestination, conjure_object::plain::ParseEnumError> {
53        match v {
54            "UPLOADS" => Ok(UploadDestination::Uploads),
55            "FILE_STORE" => Ok(UploadDestination::FileStore),
56            v => v.parse().map(|v| UploadDestination::Unknown(Unknown(v))),
57        }
58    }
59}
60impl conjure_object::FromPlain for UploadDestination {
61    type Err = conjure_object::plain::ParseEnumError;
62    #[inline]
63    fn from_plain(
64        v: &str,
65    ) -> Result<UploadDestination, conjure_object::plain::ParseEnumError> {
66        v.parse()
67    }
68}
69///An unknown variant of the UploadDestination enum.
70#[derive(
71    Debug,
72    Clone,
73    PartialEq,
74    Eq,
75    PartialOrd,
76    Ord,
77    Hash,
78    conjure_object::serde::Deserialize,
79    conjure_object::serde::Serialize,
80)]
81#[serde(crate = "conjure_object::serde", transparent)]
82pub struct Unknown(conjure_object::private::Variant);
83impl std::ops::Deref for Unknown {
84    type Target = str;
85    #[inline]
86    fn deref(&self) -> &str {
87        &self.0
88    }
89}
90impl fmt::Display for Unknown {
91    #[inline]
92    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
93        fmt::Display::fmt(&self.0, fmt)
94    }
95}