objc2_fs_kit/generated/
FSContainer.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/// An enumeration of container state values.
10///
11/// This enumeration represents values for a container's state engine.
12/// Containers start in the ``notReady`` state.
13///
14/// See also [Apple's documentation](https://developer.apple.com/documentation/fskit/fscontainerstate?language=objc)
15// NS_ENUM
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct FSContainerState(pub NSInteger);
19impl FSContainerState {
20    /// The container isn't ready.
21    #[doc(alias = "FSContainerStateNotReady")]
22    pub const NotReady: Self = Self(0);
23    /// The container is blocked from transitioning from the not-ready state to the ready state by a potentially-recoverable error.
24    ///
25    /// This state implies that the error has a resolution that would allow the container to become ready, such as correcting an incorrect password.
26    #[doc(alias = "FSContainerStateBlocked")]
27    pub const Blocked: Self = Self(1);
28    /// The container is ready, but inactive.
29    #[doc(alias = "FSContainerStateReady")]
30    pub const Ready: Self = Self(2);
31    /// The container is active, and one or more volumes are active.
32    #[doc(alias = "FSContainerStateActive")]
33    pub const Active: Self = Self(3);
34}
35
36unsafe impl Encode for FSContainerState {
37    const ENCODING: Encoding = NSInteger::ENCODING;
38}
39
40unsafe impl RefEncode for FSContainerState {
41    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44extern_class!(
45    /// A type that represents a container's status.
46    ///
47    /// This type contains two properties:
48    ///
49    /// * The ``state`` value that indicates the state of the container, such as ``FSContainerState/ready`` or ``FSContainerState/blocked``.
50    /// * The ``status`` is an error (optional in Swift, nullable in Objective-C) that provides further information about the state, such as why the container is blocked.
51    ///
52    /// Examples of statuses that require intervention include errors that indicate the container isn't ready (POSIX `EAGAIN` or `ENOTCONN`), the container needs authentication (`ENEEDAUTH`), or that authentication failed (`EAUTH`).
53    /// The status can also be an informative error, such as the FSKit error ``FSErrorStatusOperationInProgress``, possibly with the variant information of ``FSKitErrorVariantCheckStatus`` or ``FSKitErrorVariantFormatStatus``.
54    ///
55    /// See also [Apple's documentation](https://developer.apple.com/documentation/fskit/fscontainerstatus?language=objc)
56    #[unsafe(super(NSObject))]
57    #[derive(Debug, PartialEq, Eq, Hash)]
58    pub struct FSContainerStatus;
59);
60
61extern_conformance!(
62    unsafe impl NSCopying for FSContainerStatus {}
63);
64
65unsafe impl CopyingHelper for FSContainerStatus {
66    type Result = Self;
67}
68
69extern_conformance!(
70    unsafe impl NSObjectProtocol for FSContainerStatus {}
71);
72
73impl FSContainerStatus {
74    extern_methods!(
75        /// A value that represents the container state, such as ready, active, or blocked.
76        #[unsafe(method(state))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn state(&self) -> FSContainerState;
79
80        /// An optional error that provides further information about the state.
81        #[unsafe(method(status))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn status(&self) -> Option<Retained<NSError>>;
84
85        #[unsafe(method(init))]
86        #[unsafe(method_family = init)]
87        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
88
89        /// A status that represents an active container with no error.
90        ///
91        /// This value is a ``FSContainerStatus`` with a ``state`` that is ``active``, and has a ``status`` that is `nil`.
92        #[unsafe(method(active))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn active() -> Retained<FSContainerStatus>;
95
96        /// Returns a active container status instance with the provided error status.
97        ///
98        /// - Parameter errorStatus: The error status, if any, for the new instance.
99        #[unsafe(method(activeWithStatus:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn activeWithStatus(error_status: &NSError) -> Retained<Self>;
102
103        /// Returns a blocked container status instance with the provided error status.
104        ///
105        /// - Parameter errorStatus: The error status, if any, for the new instance.
106        #[unsafe(method(blockedWithStatus:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn blockedWithStatus(error_status: &NSError) -> Retained<Self>;
109
110        /// Returns a not-ready container status instance with the provided error status.
111        ///
112        /// - Parameter errorStatus: The error status, if any, for the new instance.
113        #[unsafe(method(notReadyWithStatus:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn notReadyWithStatus(error_status: &NSError) -> Retained<Self>;
116
117        /// A status that represents a ready container with no error.
118        ///
119        /// This value is a ``FSContainerStatus`` with a ``state`` that is ``ready``, and a ``status`` that is `nil`.
120        #[unsafe(method(ready))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn ready() -> Retained<FSContainerStatus>;
123
124        /// Returns a ready container status instance with the provided error status.
125        ///
126        /// - Parameter errorStatus: The error status, if any, for the new instance.
127        #[unsafe(method(readyWithStatus:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn readyWithStatus(error_status: &NSError) -> Retained<Self>;
130    );
131}
132
133/// Methods declared on superclass `NSObject`.
134impl FSContainerStatus {
135    extern_methods!(
136        #[unsafe(method(new))]
137        #[unsafe(method_family = new)]
138        pub unsafe fn new() -> Retained<Self>;
139    );
140}
141
142extern_class!(
143    /// A type that identifies a container.
144    ///
145    /// The identifier is either a UUID or a UUID with additional differentiating bytes.
146    /// Some network protocols evaluate access based on a user ID when connecting.
147    /// In this situation, when a file server receives multiple client connections with different user IDs, the server provides different file hierarchies to each.
148    /// For such systems, represent the container identifier as the UUID associated with the server, followed by four or eight bytes to differentiate connections.
149    ///
150    /// > Important: Don't subclass this class.
151    ///
152    /// See also [Apple's documentation](https://developer.apple.com/documentation/fskit/fscontaineridentifier?language=objc)
153    #[unsafe(super(FSEntityIdentifier, NSObject))]
154    #[derive(Debug, PartialEq, Eq, Hash)]
155    #[cfg(feature = "FSEntityIdentifier")]
156    pub struct FSContainerIdentifier;
157);
158
159#[cfg(feature = "FSEntityIdentifier")]
160extern_conformance!(
161    unsafe impl NSCoding for FSContainerIdentifier {}
162);
163
164#[cfg(feature = "FSEntityIdentifier")]
165extern_conformance!(
166    unsafe impl NSCopying for FSContainerIdentifier {}
167);
168
169#[cfg(feature = "FSEntityIdentifier")]
170unsafe impl CopyingHelper for FSContainerIdentifier {
171    type Result = Self;
172}
173
174#[cfg(feature = "FSEntityIdentifier")]
175extern_conformance!(
176    unsafe impl NSObjectProtocol for FSContainerIdentifier {}
177);
178
179#[cfg(feature = "FSEntityIdentifier")]
180extern_conformance!(
181    unsafe impl NSSecureCoding for FSContainerIdentifier {}
182);
183
184#[cfg(feature = "FSEntityIdentifier")]
185impl FSContainerIdentifier {
186    extern_methods!(
187        #[cfg(feature = "FSVolume")]
188        /// The volume identifier associated with the container.
189        ///
190        /// For unary file systems, the volume identifier is the same as the container identifier.
191        #[unsafe(method(volumeIdentifier))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn volumeIdentifier(&self) -> Retained<FSVolumeIdentifier>;
194    );
195}
196
197/// Methods declared on superclass `FSEntityIdentifier`.
198#[cfg(feature = "FSEntityIdentifier")]
199impl FSContainerIdentifier {
200    extern_methods!(
201        /// Creates an entity identifier with a random UUID.
202        #[unsafe(method(init))]
203        #[unsafe(method_family = init)]
204        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
205
206        /// Creates an entity identifier with the given UUID.
207        ///
208        /// - Parameter uuid: The UUID to use for this identifier.
209        #[unsafe(method(initWithUUID:))]
210        #[unsafe(method_family = init)]
211        pub unsafe fn initWithUUID(this: Allocated<Self>, uuid: &NSUUID) -> Retained<Self>;
212
213        /// Creates an entity identifier with the given UUID and qualifier data as a 64-bit unsigned integer.
214        /// - Parameters:
215        /// - uuid: The UUID to use for this identifier.
216        /// - qualifier: The data to distinguish entities that otherwise share the same UUID.
217        #[unsafe(method(initWithUUID:qualifier:))]
218        #[unsafe(method_family = init)]
219        pub unsafe fn initWithUUID_qualifier(
220            this: Allocated<Self>,
221            uuid: &NSUUID,
222            qualifier: u64,
223        ) -> Retained<Self>;
224
225        /// Creates an entity identifier with the given UUID and qualifier data.
226        ///
227        /// - Parameters:
228        /// - uuid: The UUID to use for this identifier.
229        /// - qualifierData: The data to distinguish entities that otherwise share the same UUID.
230        #[unsafe(method(initWithUUID:data:))]
231        #[unsafe(method_family = init)]
232        pub unsafe fn initWithUUID_data(
233            this: Allocated<Self>,
234            uuid: &NSUUID,
235            qualifier_data: &NSData,
236        ) -> Retained<Self>;
237    );
238}
239
240/// Methods declared on superclass `NSObject`.
241#[cfg(feature = "FSEntityIdentifier")]
242impl FSContainerIdentifier {
243    extern_methods!(
244        #[unsafe(method(new))]
245        #[unsafe(method_family = new)]
246        pub unsafe fn new() -> Retained<Self>;
247    );
248}