objc2_authentication_services/generated/
ASCredentialServiceIdentifier.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// The type of value represented by the service identifier.
10///
11/// See also [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/ascredentialserviceidentifiertype?language=objc)
12// NS_ENUM
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct ASCredentialServiceIdentifierType(pub NSInteger);
16impl ASCredentialServiceIdentifierType {
17    #[doc(alias = "ASCredentialServiceIdentifierTypeDomain")]
18    pub const Domain: Self = Self(0);
19    #[doc(alias = "ASCredentialServiceIdentifierTypeURL")]
20    pub const URL: Self = Self(1);
21}
22
23unsafe impl Encode for ASCredentialServiceIdentifierType {
24    const ENCODING: Encoding = NSInteger::ENCODING;
25}
26
27unsafe impl RefEncode for ASCredentialServiceIdentifierType {
28    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
29}
30
31extern_class!(
32    /// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/ascredentialserviceidentifier?language=objc)
33    #[unsafe(super(NSObject))]
34    #[derive(Debug, PartialEq, Eq, Hash)]
35    pub struct ASCredentialServiceIdentifier;
36);
37
38extern_conformance!(
39    unsafe impl NSCoding for ASCredentialServiceIdentifier {}
40);
41
42extern_conformance!(
43    unsafe impl NSCopying for ASCredentialServiceIdentifier {}
44);
45
46unsafe impl CopyingHelper for ASCredentialServiceIdentifier {
47    type Result = Self;
48}
49
50extern_conformance!(
51    unsafe impl NSObjectProtocol for ASCredentialServiceIdentifier {}
52);
53
54extern_conformance!(
55    unsafe impl NSSecureCoding for ASCredentialServiceIdentifier {}
56);
57
58impl ASCredentialServiceIdentifier {
59    extern_methods!(
60        /// Initializes an ASCredentialServiceIdentifier object.
61        ///
62        /// Parameter `identifier`: string value for the service identifier.
63        ///
64        /// Parameter `type`: the type that the service identifier string represents.
65        #[unsafe(method(initWithIdentifier:type:))]
66        #[unsafe(method_family = init)]
67        pub unsafe fn initWithIdentifier_type(
68            this: Allocated<Self>,
69            identifier: &NSString,
70            r#type: ASCredentialServiceIdentifierType,
71        ) -> Retained<Self>;
72
73        /// Get the identifier.
74        ///
75        /// Returns: The service identifier.
76        #[unsafe(method(identifier))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn identifier(&self) -> Retained<NSString>;
79
80        /// Get the service identifier type.
81        ///
82        /// Returns: The service identifier type.
83        #[unsafe(method(type))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn r#type(&self) -> ASCredentialServiceIdentifierType;
86    );
87}
88
89/// Methods declared on superclass `NSObject`.
90impl ASCredentialServiceIdentifier {
91    extern_methods!(
92        #[unsafe(method(init))]
93        #[unsafe(method_family = init)]
94        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
95
96        #[unsafe(method(new))]
97        #[unsafe(method_family = new)]
98        pub unsafe fn new() -> Retained<Self>;
99    );
100}