rust_macios/contacts/
cn_postal_address.rs1use objc::{msg_send, sel, sel_impl};
2
3use crate::{
4 foundation::NSString,
5 object,
6 objective_c_runtime::{
7 macros::interface_impl,
8 traits::{FromId, PNSObject},
9 },
10};
11
12object! {
13 unsafe pub struct CNPostalAddress;
15}
16
17#[interface_impl(NSObject)]
18impl CNPostalAddress {
19 #[property]
24 pub fn street(&self) -> NSString {
25 unsafe { NSString::from_id(msg_send![self.m_self(), street]) }
26 }
27
28 #[property]
30 pub fn city(&self) -> NSString {
31 unsafe { NSString::from_id(msg_send![self.m_self(), city]) }
32 }
33
34 #[property]
36 pub fn state(&self) -> NSString {
37 unsafe { NSString::from_id(msg_send![self.m_self(), state]) }
38 }
39
40 #[property]
42 pub fn postal_code(&self) -> NSString {
43 unsafe { NSString::from_id(msg_send![self.m_self(), postalCode]) }
44 }
45
46 #[property]
48 pub fn country(&self) -> NSString {
49 unsafe { NSString::from_id(msg_send![self.m_self(), country]) }
50 }
51
52 #[property]
54 pub fn iso_country_code(&self) -> NSString {
55 unsafe { NSString::from_id(msg_send![self.m_self(), ISOCountryCode]) }
56 }
57
58 #[property]
60 pub fn sub_administrative_area(&self) -> NSString {
61 unsafe { NSString::from_id(msg_send![self.m_self(), subAdministrativeArea]) }
62 }
63
64 #[property]
66 pub fn sub_locality(&self) -> NSString {
67 unsafe { NSString::from_id(msg_send![self.m_self(), subLocality]) }
68 }
69
70 pub fn localized_string_for_key(key: NSString) -> NSString {
75 unsafe { NSString::from_id(msg_send![self.m_self(), localizedStringForKey: key]) }
76 }
77}