1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
use conjure_object::serde::ser::SerializeStruct as SerializeStruct_;
use conjure_object::serde::{de, ser};
use std::fmt;
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
pub struct Dataset {
    file_system_id: String,
    rid: conjure_object::ResourceIdentifier,
}
impl Dataset {
    #[doc = r" Constructs a new instance of the type."]
    #[inline]
    pub fn new<T>(file_system_id: T, rid: conjure_object::ResourceIdentifier) -> Dataset
    where
        T: Into<String>,
    {
        Dataset {
            file_system_id: file_system_id.into(),
            rid: rid,
        }
    }
    #[doc = r" Returns a new builder."]
    #[inline]
    pub fn builder() -> Builder {
        Default::default()
    }
    #[inline]
    pub fn file_system_id(&self) -> &str {
        &*self.file_system_id
    }
    #[doc = "Uniquely identifies this dataset."]
    #[inline]
    pub fn rid(&self) -> &conjure_object::ResourceIdentifier {
        &self.rid
    }
}
#[doc = "A builder for the `Dataset` type."]
#[derive(Debug, Clone, Default)]
pub struct Builder {
    file_system_id: Option<String>,
    rid: Option<conjure_object::ResourceIdentifier>,
}
impl Builder {
    #[doc = r""]
    #[doc = r" Required."]
    pub fn file_system_id<T>(&mut self, file_system_id: T) -> &mut Self
    where
        T: Into<String>,
    {
        self.file_system_id = Some(file_system_id.into());
        self
    }
    #[doc = "Uniquely identifies this dataset."]
    #[doc = r""]
    #[doc = r" Required."]
    #[inline]
    pub fn rid(&mut self, rid: conjure_object::ResourceIdentifier) -> &mut Self {
        self.rid = Some(rid);
        self
    }
    #[doc = r" Constructs a new instance of the type."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Panics if a required field was not set."]
    #[inline]
    pub fn build(&self) -> Dataset {
        Dataset {
            file_system_id: self
                .file_system_id
                .clone()
                .expect("field file_system_id was not set"),
            rid: self.rid.clone().expect("field rid was not set"),
        }
    }
}
impl From<Dataset> for Builder {
    #[inline]
    fn from(_v: Dataset) -> Builder {
        Builder {
            file_system_id: Some(_v.file_system_id),
            rid: Some(_v.rid),
        }
    }
}
impl ser::Serialize for Dataset {
    fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
    where
        S: ser::Serializer,
    {
        let size = 2usize;
        let mut s = s.serialize_struct("Dataset", size)?;
        s.serialize_field("fileSystemId", &self.file_system_id)?;
        s.serialize_field("rid", &self.rid)?;
        s.end()
    }
}
impl<'de> de::Deserialize<'de> for Dataset {
    fn deserialize<D>(d: D) -> Result<Dataset, D::Error>
    where
        D: de::Deserializer<'de>,
    {
        d.deserialize_struct("Dataset", &["fileSystemId", "rid"], Visitor_)
    }
}
struct Visitor_;
impl<'de> de::Visitor<'de> for Visitor_ {
    type Value = Dataset;
    fn expecting(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        fmt.write_str("map")
    }
    fn visit_map<A>(self, mut map_: A) -> Result<Dataset, A::Error>
    where
        A: de::MapAccess<'de>,
    {
        let mut file_system_id = None;
        let mut rid = None;
        while let Some(field_) = map_.next_key()? {
            match field_ {
                Field_::FileSystemId => file_system_id = Some(map_.next_value()?),
                Field_::Rid => rid = Some(map_.next_value()?),
                Field_::Unknown_ => {
                    map_.next_value::<de::IgnoredAny>()?;
                }
            }
        }
        let file_system_id = match file_system_id {
            Some(v) => v,
            None => return Err(de::Error::missing_field("fileSystemId")),
        };
        let rid = match rid {
            Some(v) => v,
            None => return Err(de::Error::missing_field("rid")),
        };
        Ok(Dataset {
            file_system_id,
            rid,
        })
    }
}
enum Field_ {
    FileSystemId,
    Rid,
    Unknown_,
}
impl<'de> de::Deserialize<'de> for Field_ {
    fn deserialize<D>(d: D) -> Result<Field_, D::Error>
    where
        D: de::Deserializer<'de>,
    {
        d.deserialize_str(FieldVisitor_)
    }
}
struct FieldVisitor_;
impl<'de> de::Visitor<'de> for FieldVisitor_ {
    type Value = Field_;
    fn expecting(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        fmt.write_str("string")
    }
    fn visit_str<E>(self, value: &str) -> Result<Field_, E>
    where
        E: de::Error,
    {
        let v = match value {
            "fileSystemId" => Field_::FileSystemId,
            "rid" => Field_::Rid,
            _ => Field_::Unknown_,
        };
        Ok(v)
    }
}