1use alloc::string::String;
4
5#[derive(Clone, Debug, PartialEq, Eq, Hash)]
10#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
11#[cfg_attr(feature = "serde", serde(rename_all = "kebab-case"))]
12pub struct Address {
13 pub name: Option<String>,
15
16 pub email: String,
18}
19
20impl Address {
21 pub fn new(email: impl Into<String>) -> Self {
22 Self {
23 name: None,
24 email: email.into(),
25 }
26 }
27
28 pub fn with_name(mut self, name: impl Into<String>) -> Self {
29 self.name = Some(name.into());
30 self
31 }
32}