Skip to main content

photokit/
lib.rs

1#![doc = include_str!("../README.md")]
2#![cfg_attr(docsrs, feature(doc_cfg))]
3#![allow(
4    clippy::cargo_common_metadata,
5    clippy::doc_markdown,
6    clippy::manual_map,
7    clippy::missing_const_for_fn,
8    clippy::missing_errors_doc,
9    clippy::module_name_repetitions,
10    clippy::must_use_candidate,
11    clippy::option_if_let_else,
12    clippy::return_self_not_must_use,
13    clippy::single_option_map,
14    clippy::struct_excessive_bools,
15    clippy::type_complexity
16)]
17
18/// Wraps `PHAsset`, `PHAssetResource`, and related Photos framework asset types.
19pub mod asset;
20/// Wraps `PHAssetChangeRequest` mutation APIs.
21pub mod asset_change_request;
22/// Wraps `PHAssetCollection` and related Photos framework collection types.
23pub mod asset_collection;
24/// Wraps `PHAssetCollectionChangeRequest` mutation APIs.
25pub mod asset_collection_change_request;
26/// Wraps `PHAssetCreationRequest` creation APIs.
27pub mod asset_creation_request;
28/// Wraps `PHAssetResourceManager`.
29pub mod asset_resource_manager;
30#[cfg(feature = "async")]
31/// Async wrappers for Photos framework completion-handler APIs.
32pub mod async_api;
33/// Wraps `PHChange`.
34pub mod change;
35/// Traits for Photos framework change-request wrappers.
36pub mod change_request;
37/// Wraps `PHCloudIdentifier` and related Photos framework identifier mappings.
38pub mod cloud_identifier;
39/// Wraps `PHCollection`.
40pub mod collection;
41/// Wraps `PHCollectionList` and related Photos framework list types.
42pub mod collection_list;
43/// Wraps `PHCollectionListChangeRequest` mutation APIs.
44pub mod collection_list_change_request;
45/// Wraps the `PHContentEditingController` protocol contract.
46pub mod content_editing_controller;
47/// Wraps `PHContentEditingInput` and related Photos framework editing-input types.
48pub mod content_editing_input;
49/// Wraps `PHContentEditingOutput` and related Photos framework editing-output types.
50pub mod content_editing_output;
51/// Wraps Photos framework authorization and error values.
52pub mod error;
53/// Wraps `PHFetchOptions`.
54pub mod fetch_options;
55/// Wraps `PHFetchResult`.
56pub mod fetch_result;
57/// Wraps `PHFetchResultChangeDetails`.
58pub mod fetch_result_change_details;
59mod ffi;
60/// Shared geometry and color helper payloads used by PhotosUI wrappers.
61pub mod geometry;
62/// Wraps `PHImageManager` and `PHCachingImageManager`.
63pub mod image_manager;
64/// Re-exports Photos framework wrapper types.
65pub mod library;
66/// Wraps `PHLivePhoto` and related request results.
67pub mod live_photo;
68/// Wraps `PHLivePhotoEditingContext` and related frame-processing types.
69pub mod live_photo_editing_context;
70/// Wraps `PHLivePhotoView` and related PhotosUI playback callbacks.
71pub mod live_photo_view;
72/// Wraps `PHObject` and `PHObjectPlaceholder`.
73pub mod object;
74/// Wraps `PHObjectChangeDetails`.
75pub mod object_change_details;
76/// Wraps persistent change history Photos framework types.
77pub mod persistent_change;
78/// Wraps the `PHPicker` family in PhotosUI.
79pub mod picker;
80/// Wraps `PHPhotoLibrary` and observer registration APIs.
81pub mod photo_library;
82mod private;
83/// Wraps `PHProject` and `PHProjectChangeRequest`.
84pub mod project;
85/// Wraps PhotosUI project-extension context and type-description helpers.
86pub mod project_extension;
87/// Wraps PhotosUI `PHProjectInfo` and related immutable project-content types.
88pub mod project_info;
89/// Re-exports shared Photos framework wrapper types.
90pub mod types;
91
92pub use asset::{
93    PHAsset, PHAssetBurstSelectionType, PHAssetEditOperation, PHAssetMediaSubtype,
94    PHAssetPlaybackStyle, PHAssetResource, PHAssetResourceType, PHAssetSourceType, PHCoordinate,
95    PHMediaType,
96};
97pub use asset_change_request::PHAssetChangeRequest;
98pub use asset_collection::{
99    PHAssetCollection, PHAssetCollectionSubtype, PHAssetCollectionType, PHCollectionEditOperation,
100};
101pub use asset_collection_change_request::{
102    PHAssetCollectionAssetMutation, PHAssetCollectionChangeRequest,
103};
104pub use asset_creation_request::{
105    PHAssetCreationRequest, PHAssetCreationResource, PHAssetResourceCreationOptions,
106};
107pub use asset_resource_manager::{
108    PHAssetResourceDataResult, PHAssetResourceManager, PHAssetResourceRequestOptions,
109    PHAssetResourceWriteResult,
110};
111pub use change::PHChange;
112pub use change_request::PHChangeRequest;
113pub use cloud_identifier::{PHCloudIdentifier, PHCloudIdentifierMapping, PHLocalIdentifierMapping};
114pub use collection::PHCollection;
115pub use collection_list::{PHCollectionList, PHCollectionListSubtype, PHCollectionListType};
116pub use collection_list_change_request::{
117    PHCollectionListChangeRequest, PHCollectionListChildMutation,
118};
119pub use content_editing_controller::{
120    PHContentEditingController, PHContentEditingPlaceholderImage,
121};
122pub use content_editing_input::{
123    PHAdjustmentData, PHContentEditingInput, PHContentEditingInputInfo,
124    PHContentEditingInputRequestOptions,
125};
126pub use content_editing_output::{PHContentEditingOutput, PHContentEditingOutputInfo};
127pub use error::{
128    NSErrorInfo, PHAuthorizationStatus, PHLocalIdentifiersErrorKey, PHPhotosError,
129    PHPhotosErrorDomain, PhotoKitError,
130};
131pub use fetch_options::{PHFetchOptions, PHSortDescriptor};
132pub use fetch_result::PHFetchResult;
133pub use fetch_result_change_details::{PHFetchResultChangeDetails, PHFetchResultMove};
134pub use geometry::{PHColor, PHRect};
135pub use image_manager::{
136    PHCachingImageManager, PHImageContentMode, PHImageDataRequestHandle, PHImageDataResult,
137    PHImageErrorKey, PHImageManager, PHImageManagerMaximumSize, PHImageRequest,
138    PHImageRequestHandle, PHImageRequestOptionsDeliveryMode, PHImageRequestOptionsResizeMode,
139    PHImageRequestOptionsVersion, PHImageResult, PHImageResultRequestIDKey, PHImageSize,
140    PHLivePhotoRequestHandle, PHVideoRequestOptions, PHVideoRequestOptionsDeliveryMode,
141    PHVideoRequestOptionsVersion, PHVideoResult,
142};
143pub use live_photo::{PHLivePhoto, PHLivePhotoInfoErrorKey, PHLivePhotoResult};
144pub use live_photo_editing_context::{
145    PHLivePhotoEditingContext, PHLivePhotoEditingContextInfo, PHLivePhotoEditingSaveResult,
146    PHLivePhotoFrame, PHLivePhotoFrameProcessingDecision, PHLivePhotoFrameType,
147};
148pub use live_photo_view::{
149    PHLivePhotoView, PHLivePhotoViewContentMode, PHLivePhotoViewDelegate,
150    PHLivePhotoViewDelegateEvent, PHLivePhotoViewDelegateEventKind, PHLivePhotoViewInfo,
151    PHLivePhotoViewPlaybackStyle,
152};
153pub use object::{PHObject, PHObjectPlaceholder};
154pub use object_change_details::PHObjectChangeDetails;
155pub use persistent_change::{
156    PHObjectType, PHPersistentChange, PHPersistentChangeFetchResult, PHPersistentChangeToken,
157    PHPersistentObjectChangeDetails,
158};
159pub use photo_library::{
160    PHAccessLevel, PHAvailabilityObserver, PHChangeObserver, PHPhotoLibrary,
161    PHPhotoLibraryAvailabilityChange, PHPhotoLibraryChange,
162};
163pub use picker::{
164    PHDirectionalRectEdge, PHItemProviderInfo, PHPickerCapabilities, PHPickerConfiguration,
165    PHPickerConfigurationAssetRepresentationMode, PHPickerConfigurationSelection,
166    PHPickerFilter, PHPickerMode, PHPickerResult, PHPickerUpdateConfiguration,
167    PHPickerViewController, PHPickerViewControllerDelegate,
168};
169pub use project::{PHProject, PHProjectChangeRequest};
170pub use project_extension::{
171    PHProjectExtensionContext, PHProjectExtensionController, PHProjectTypeDescription,
172    PHProjectTypeDescriptionDataSource, PHProjectTypeDescriptionInvalidator,
173};
174pub use project_info::{
175    PHProjectAssetElement, PHProjectCreationSource, PHProjectElement, PHProjectInfo,
176    PHProjectJournalEntryElement, PHProjectMapAnnotation, PHProjectMapElement,
177    PHProjectRegionOfInterest, PHProjectSection, PHProjectSectionContent,
178    PHProjectSectionElement, PHProjectSectionType, PHProjectTextElement,
179    PHProjectTextElementType,
180};
181
182/// Common imports.
183pub mod prelude {
184    pub use crate::asset::{
185        PHAsset, PHAssetBurstSelectionType, PHAssetEditOperation, PHAssetMediaSubtype,
186        PHAssetPlaybackStyle, PHAssetResource, PHAssetResourceType, PHAssetSourceType,
187        PHCoordinate, PHMediaType,
188    };
189    pub use crate::asset_change_request::PHAssetChangeRequest;
190    pub use crate::asset_collection::{
191        PHAssetCollection, PHAssetCollectionSubtype, PHAssetCollectionType,
192        PHCollectionEditOperation,
193    };
194    pub use crate::asset_collection_change_request::{
195        PHAssetCollectionAssetMutation, PHAssetCollectionChangeRequest,
196    };
197    pub use crate::asset_creation_request::{
198        PHAssetCreationRequest, PHAssetCreationResource, PHAssetResourceCreationOptions,
199    };
200    pub use crate::asset_resource_manager::{
201        PHAssetResourceDataResult, PHAssetResourceManager, PHAssetResourceRequestOptions,
202        PHAssetResourceWriteResult,
203    };
204    pub use crate::change::PHChange;
205    pub use crate::change_request::PHChangeRequest;
206    pub use crate::cloud_identifier::{
207        PHCloudIdentifier, PHCloudIdentifierMapping, PHLocalIdentifierMapping,
208    };
209    pub use crate::collection::PHCollection;
210    pub use crate::collection_list::{
211        PHCollectionList, PHCollectionListSubtype, PHCollectionListType,
212    };
213    pub use crate::collection_list_change_request::{
214        PHCollectionListChangeRequest, PHCollectionListChildMutation,
215    };
216    pub use crate::content_editing_controller::{
217        PHContentEditingController, PHContentEditingPlaceholderImage,
218    };
219    pub use crate::content_editing_input::{
220        PHAdjustmentData, PHContentEditingInput, PHContentEditingInputInfo,
221        PHContentEditingInputRequestOptions,
222    };
223    pub use crate::content_editing_output::{PHContentEditingOutput, PHContentEditingOutputInfo};
224    pub use crate::error::{
225        NSErrorInfo, PHAuthorizationStatus, PHLocalIdentifiersErrorKey, PHPhotosError,
226        PHPhotosErrorDomain, PhotoKitError,
227    };
228    pub use crate::fetch_options::{PHFetchOptions, PHSortDescriptor};
229    pub use crate::fetch_result::PHFetchResult;
230    pub use crate::fetch_result_change_details::{PHFetchResultChangeDetails, PHFetchResultMove};
231    pub use crate::geometry::{PHColor, PHRect};
232    pub use crate::image_manager::{
233        PHCachingImageManager, PHImageContentMode, PHImageDataRequestHandle, PHImageDataResult,
234        PHImageErrorKey, PHImageManager, PHImageManagerMaximumSize, PHImageRequest,
235        PHImageRequestHandle, PHImageRequestOptionsDeliveryMode, PHImageRequestOptionsResizeMode,
236        PHImageRequestOptionsVersion, PHImageResult, PHImageResultRequestIDKey, PHImageSize,
237        PHLivePhotoRequestHandle, PHVideoRequestOptions, PHVideoRequestOptionsDeliveryMode,
238        PHVideoRequestOptionsVersion, PHVideoResult,
239    };
240    pub use crate::live_photo::{PHLivePhoto, PHLivePhotoInfoErrorKey, PHLivePhotoResult};
241    pub use crate::live_photo_editing_context::{
242        PHLivePhotoEditingContext, PHLivePhotoEditingContextInfo, PHLivePhotoEditingSaveResult,
243        PHLivePhotoFrame, PHLivePhotoFrameProcessingDecision, PHLivePhotoFrameType,
244    };
245    pub use crate::live_photo_view::{
246        PHLivePhotoView, PHLivePhotoViewContentMode, PHLivePhotoViewDelegate,
247        PHLivePhotoViewDelegateEvent, PHLivePhotoViewDelegateEventKind, PHLivePhotoViewInfo,
248        PHLivePhotoViewPlaybackStyle,
249    };
250    pub use crate::object::{PHObject, PHObjectPlaceholder};
251    pub use crate::object_change_details::PHObjectChangeDetails;
252    pub use crate::persistent_change::{
253        PHObjectType, PHPersistentChange, PHPersistentChangeFetchResult, PHPersistentChangeToken,
254        PHPersistentObjectChangeDetails,
255    };
256    pub use crate::photo_library::{
257        PHAccessLevel, PHAvailabilityObserver, PHChangeObserver, PHPhotoLibrary,
258        PHPhotoLibraryAvailabilityChange, PHPhotoLibraryChange,
259    };
260    pub use crate::picker::{
261        PHDirectionalRectEdge, PHItemProviderInfo, PHPickerCapabilities, PHPickerConfiguration,
262        PHPickerConfigurationAssetRepresentationMode, PHPickerConfigurationSelection,
263        PHPickerFilter, PHPickerMode, PHPickerResult, PHPickerUpdateConfiguration,
264        PHPickerViewController, PHPickerViewControllerDelegate,
265    };
266    pub use crate::project::{PHProject, PHProjectChangeRequest};
267    pub use crate::project_extension::{
268        PHProjectExtensionContext, PHProjectExtensionController, PHProjectTypeDescription,
269        PHProjectTypeDescriptionDataSource, PHProjectTypeDescriptionInvalidator,
270    };
271    pub use crate::project_info::{
272        PHProjectAssetElement, PHProjectCreationSource, PHProjectElement, PHProjectInfo,
273        PHProjectJournalEntryElement, PHProjectMapAnnotation, PHProjectMapElement,
274        PHProjectRegionOfInterest, PHProjectSection, PHProjectSectionContent,
275        PHProjectSectionElement, PHProjectSectionType, PHProjectTextElement,
276        PHProjectTextElementType,
277    };
278}