objc2_fs_kit/generated/FSUnaryFileSystem.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 /// An abstract base class for implementing a minimal file system.
12 ///
13 /// `FSUnaryFileSystem` is a simplified file system, which works with one ``FSResource`` and presents it as one ``FSVolume``.
14 ///
15 /// The one volume and its container have a shared state and lifetime, a more constrained life cycle than the ``FSFileSystem`` design flow.
16 ///
17 /// Implement your app extension by providing a subclass of `FSUnaryFileSystem` as a delegate object.
18 /// Your delegate also needs to implement the ``FSUnaryFileSystemOperations`` protocol so that it can load resources.
19 ///
20 /// See also [Apple's documentation](https://developer.apple.com/documentation/fskit/fsunaryfilesystem?language=objc)
21 #[unsafe(super(NSObject))]
22 #[derive(Debug, PartialEq, Eq, Hash)]
23 pub struct FSUnaryFileSystem;
24);
25
26#[cfg(feature = "FSFileSystemBase")]
27extern_conformance!(
28 unsafe impl FSFileSystemBase for FSUnaryFileSystem {}
29);
30
31extern_conformance!(
32 unsafe impl NSObjectProtocol for FSUnaryFileSystem {}
33);
34
35impl FSUnaryFileSystem {
36 extern_methods!();
37}
38
39/// Methods declared on superclass `NSObject`.
40impl FSUnaryFileSystem {
41 extern_methods!(
42 #[unsafe(method(init))]
43 #[unsafe(method_family = init)]
44 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
45
46 #[unsafe(method(new))]
47 #[unsafe(method_family = new)]
48 pub unsafe fn new() -> Retained<Self>;
49 );
50}
51
52extern_protocol!(
53 /// Operations performed by a unary file system.
54 ///
55 /// Make sure your subclass of ``FSUnaryFileSystem`` conforms to this protocol.
56 ///
57 /// See also [Apple's documentation](https://developer.apple.com/documentation/fskit/fsunaryfilesystemoperations?language=objc)
58 pub unsafe trait FSUnaryFileSystemOperations: NSObjectProtocol {
59 #[cfg(all(feature = "FSResource", feature = "block2"))]
60 /// Requests that the file system probe the specified resource.
61 ///
62 /// Implement this method to indicate whether the resource is recognizable and usable.
63 /// - Parameters:
64 /// - resource: The ``FSResource`` to probe.
65 /// - reply: A block or closure that your implementation invokes when it finishes the probe or encounters an error. Pass an instance of ``FSProbeResult`` with probe results as the first parameter if your probe operation succeeds. If probing fails, pass an error as the second parameter.
66 #[unsafe(method(probeResource:replyHandler:))]
67 #[unsafe(method_family = none)]
68 unsafe fn probeResource_replyHandler(
69 &self,
70 resource: &FSResource,
71 reply: &block2::DynBlock<dyn Fn(*mut FSProbeResult, *mut NSError)>,
72 );
73
74 #[cfg(all(
75 feature = "FSResource",
76 feature = "FSTaskOptions",
77 feature = "FSVolume",
78 feature = "block2"
79 ))]
80 /// Requests that the file system load a resource and present it as a volume.
81 ///
82 /// Implement this method by inspecting the provided resource and verifying it uses a supported format.
83 /// If the resource does use a supported format, create a subclass of `FSVolume`, clear the container error state, and invoke the `reply` callback, passing your volume as a parameter.
84 /// If loading can't proceed, invoke `reply` and send an appropriate error as the second parameter.
85 ///
86 /// - Parameters:
87 /// - resource: An ``FSResource`` to load.
88 /// - options: An ``FSTaskOptions`` object specifying options to apply when loading the resource. An ``FSUnaryFileSystem`` supports two options: `-f` for "force" and `--rdonly` for read-only. The file system must remember if the read-only option is present.
89 /// - reply: A block or closure that your implementation invokes when it finishes setting up or encounters an error. Pass a subclass of `FSVolume` as the first parameter if loading succeeds. If loading fails, pass an error as the second parameter.
90 #[unsafe(method(loadResource:options:replyHandler:))]
91 #[unsafe(method_family = none)]
92 unsafe fn loadResource_options_replyHandler(
93 &self,
94 resource: &FSResource,
95 options: &FSTaskOptions,
96 reply: &block2::DynBlock<dyn Fn(*mut FSVolume, *mut NSError)>,
97 );
98
99 #[cfg(all(feature = "FSResource", feature = "FSTaskOptions", feature = "block2"))]
100 /// Requests that the file system unload the specified resource.
101 ///
102 /// - Parameters:
103 /// - resource: An ``FSResource`` to unload.
104 /// - options: An ``FSTaskOptions`` object specifying options to apply when unloading the resource.
105 /// - reply: A block or closure that your implementation invokes when it finishes unloading or encounters an error. If unloading fails, pass an error as the parameter to describe the problem. Otherwise, pass `nil`.
106 #[unsafe(method(unloadResource:options:replyHandler:))]
107 #[unsafe(method_family = none)]
108 unsafe fn unloadResource_options_replyHandler(
109 &self,
110 resource: &FSResource,
111 options: &FSTaskOptions,
112 reply: &block2::DynBlock<dyn Fn(*mut NSError)>,
113 );
114
115 /// Notifies you that the system finished loading your file system extension.
116 ///
117 /// The system performs this callback after the main run loop starts and before receiving the first message from the FSKit daemon.
118 ///
119 /// Implement this method if you want to perform any setup prior to receiving FSKit callbacks.
120 #[optional]
121 #[unsafe(method(didFinishLoading))]
122 #[unsafe(method_family = none)]
123 unsafe fn didFinishLoading(&self);
124 }
125);