cidre 0.9.0

Apple frameworks bindings for rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
use crate::{arc, define_cls, define_obj_type, ns, objc};

#[cfg(feature = "cf")]
use crate::cf;

use super::Class;

define_obj_type!(
    #[doc(alias = "NSURLResourceKey")]
    pub ResKey(ns::String)
);

define_obj_type!(
    #[doc(alias = "NSURL")]
    pub Url(ns::Id)
);

impl arc::A<Url> {
    #[objc::msg_send(initFileURLWithPath:isDirectory:relativeToURL:)]
    pub fn init_with_path_is_dir_relative_to_url(
        self,
        path: &ns::String,
        is_dir: bool,
        relative_to: Option<&ns::Url>,
    ) -> arc::R<Url>;

    #[objc::msg_send(initWithString:relativeToURL:)]
    pub fn init_with_string_relative_to(
        self,
        string: &ns::String,
        relative_to: Option<&ns::Url>,
    ) -> Option<arc::R<ns::Url>>;
}

impl Url {
    define_cls!(NS_URL);

    #[inline]
    pub fn file_url_relative_to(
        path: &ns::String,
        is_dir: bool,
        relative_to: Option<&ns::Url>,
    ) -> arc::R<Self> {
        Self::alloc().init_with_path_is_dir_relative_to_url(path, is_dir, relative_to)
    }

    #[inline]
    pub fn with_fs_path_string(path: &ns::String, is_dir: bool) -> arc::R<Self> {
        Self::file_url_relative_to(path, is_dir, None)
    }

    #[inline]
    pub fn with_fs_path_str(path: &str, is_dir: bool) -> arc::R<Self> {
        let string = ns::String::with_str_no_copy(path);
        Self::file_url_relative_to(&string, is_dir, None)
    }

    #[inline]
    pub fn with_string_relative_to(
        str: &ns::String,
        relative_to: Option<&ns::Url>,
    ) -> Option<arc::R<Self>> {
        Self::alloc().init_with_string_relative_to(str, relative_to)
    }

    #[inline]
    pub fn with_string(str: &ns::String) -> Option<arc::R<Self>> {
        Self::alloc().init_with_string_relative_to(str, None)
    }

    #[inline]
    pub fn with_str_relative_to(str: &str, relative_to: Option<&ns::Url>) -> Option<arc::R<Self>> {
        let string = ns::String::with_str_no_copy(str);
        Self::with_string_relative_to(&string, relative_to)
    }

    #[inline]
    pub fn with_str(str: &str) -> Option<arc::R<Self>> {
        let string = ns::String::with_str_no_copy(str);
        Self::with_string_relative_to(&string, None)
    }

    #[objc::msg_send(absoluteString)]
    pub fn abs_string(&self) -> Option<arc::R<ns::String>>;

    #[objc::msg_send(resourceValuesForKeys:error:)]
    pub unsafe fn res_values_for_keys_err<'ear>(
        &self,
        keys: &ns::Array<ns::UrlResKey>,
        err: *mut Option<&ns::Error>,
    ) -> Option<arc::R<ns::Dictionary<ns::UrlResKey, ns::Id>>>;

    #[inline]
    pub fn res_values_for_keys<'ear>(
        &self,
        keys: &ns::Array<ns::UrlResKey>,
    ) -> Result<arc::R<ns::Dictionary<ns::UrlResKey, ns::Id>>, &'ear ns::Error> {
        ns::if_none(|err| unsafe { self.res_values_for_keys_err(keys, err) })
    }

    #[objc::msg_send(startAccessingSecurityScopedResource)]
    pub fn start_accessing_security_scoped_resource(&self) -> bool;

    #[objc::msg_send(stopAccessingSecurityScopedResource)]
    pub fn stop_accessing_security_scoped_resource(&self);
}

#[cfg(feature = "cf")]
impl Url {
    #[inline]
    pub fn as_cf(&self) -> &cf::Url {
        unsafe { std::mem::transmute(self) }
    }
}

#[cfg(feature = "cf")]
impl AsRef<cf::Url> for Url {
    #[inline]
    fn as_ref(&self) -> &cf::Url {
        self.as_cf()
    }
}

unsafe impl Send for Url {}

#[link(name = "ns", kind = "static")]
unsafe extern "C" {
    static NS_URL: &'static Class<Url>;
}

impl ResKey {
    #[inline]
    pub fn name() -> &'static Self {
        unsafe { NSURLNameKey }
    }

    #[inline]
    pub fn localized_name() -> &'static Self {
        unsafe { NSURLLocalizedNameKey }
    }

    #[inline]
    pub fn is_regular_file() -> &'static Self {
        unsafe { NSURLIsRegularFileKey }
    }

    #[inline]
    pub fn is_directory() -> &'static Self {
        unsafe { NSURLIsDirectoryKey }
    }

    #[inline]
    pub fn is_symbolic_link() -> &'static Self {
        unsafe { NSURLIsSymbolicLinkKey }
    }

    #[inline]
    pub fn is_volume() -> &'static Self {
        unsafe { NSURLIsVolumeKey }
    }

    #[inline]
    pub fn is_package() -> &'static Self {
        unsafe { NSURLIsPackageKey }
    }

    #[inline]
    pub fn is_application() -> &'static Self {
        unsafe { NSURLIsApplicationKey }
    }

    #[inline]
    pub fn application_is_scriptable() -> &'static Self {
        unsafe { NSURLApplicationIsScriptableKey }
    }

    #[inline]
    pub fn is_system_immutable() -> &'static Self {
        unsafe { NSURLIsSystemImmutableKey }
    }

    #[inline]
    pub fn is_user_immutable() -> &'static Self {
        unsafe { NSURLIsUserImmutableKey }
    }

    #[inline]
    pub fn is_hidden() -> &'static Self {
        unsafe { NSURLIsHiddenKey }
    }

    #[inline]
    pub fn has_hidden_extension() -> &'static Self {
        unsafe { NSURLHasHiddenExtensionKey }
    }

    #[inline]
    pub fn creation_date() -> &'static Self {
        unsafe { NSURLCreationDateKey }
    }

    #[inline]
    pub fn access_date() -> &'static Self {
        unsafe { NSURLContentAccessDateKey }
    }

    #[inline]
    pub fn content_modification_date() -> &'static Self {
        unsafe { NSURLContentModificationDateKey }
    }

    #[inline]
    pub fn attribute_modification_date() -> &'static Self {
        unsafe { NSURLAttributeModificationDateKey }
    }

    #[inline]
    pub fn link_count() -> &'static Self {
        unsafe { NSURLLinkCountKey }
    }

    #[inline]
    pub fn parent_directory() -> &'static Self {
        unsafe { NSURLParentDirectoryURLKey }
    }

    #[inline]
    pub fn volume_url() -> &'static Self {
        unsafe { NSURLVolumeURLKey }
    }

    #[inline]
    pub fn content_type() -> &'static Self {
        unsafe { NSURLContentTypeKey }
    }

    #[inline]
    pub fn localized_type_desc() -> &'static Self {
        unsafe { NSURLLocalizedTypeDescriptionKey }
    }

    #[inline]
    pub fn label_number() -> &'static Self {
        unsafe { NSURLLabelNumberKey }
    }

    #[inline]
    pub fn label_color() -> &'static Self {
        unsafe { NSURLLabelColorKey }
    }

    #[inline]
    pub fn localized_label() -> &'static Self {
        unsafe { NSURLLocalizedLabelKey }
    }

    #[inline]
    pub fn effective_icon() -> &'static Self {
        unsafe { NSURLEffectiveIconKey }
    }

    #[inline]
    pub fn custom_icon() -> &'static Self {
        unsafe { NSURLCustomIconKey }
    }

    #[inline]
    pub fn file_resource_id() -> &'static Self {
        unsafe { NSURLFileResourceIdentifierKey }
    }

    #[inline]
    pub fn volume_id() -> &'static Self {
        unsafe { NSURLVolumeIdentifierKey }
    }

    #[inline]
    pub fn preferred_io_block_size() -> &'static Self {
        unsafe { NSURLPreferredIOBlockSizeKey }
    }

    #[inline]
    pub fn is_readable() -> &'static Self {
        unsafe { NSURLIsReadableKey }
    }

    #[inline]
    pub fn is_writable() -> &'static Self {
        unsafe { NSURLIsWritableKey }
    }

    #[inline]
    pub fn is_executable() -> &'static Self {
        unsafe { NSURLIsExecutableKey }
    }

    #[inline]
    pub fn file_security() -> &'static Self {
        unsafe { NSURLFileSecurityKey }
    }

    #[inline]
    pub fn is_excluded_from_backup() -> &'static Self {
        unsafe { NSURLIsExcludedFromBackupKey }
    }

    #[inline]
    pub fn tag_names() -> &'static Self {
        unsafe { NSURLTagNamesKey }
    }

    #[inline]
    pub fn path() -> &'static Self {
        unsafe { NSURLPathKey }
    }

    #[inline]
    pub fn cannonical_path() -> &'static Self {
        unsafe { NSURLCanonicalPathKey }
    }

    #[inline]
    pub fn is_mount_trigger() -> &'static Self {
        unsafe { NSURLIsMountTriggerKey }
    }

    #[inline]
    pub fn generation_id() -> &'static Self {
        unsafe { NSURLGenerationIdentifierKey }
    }

    #[inline]
    pub fn document_id() -> &'static Self {
        unsafe { NSURLDocumentIdentifierKey }
    }

    #[inline]
    pub fn added_to_directory_date() -> &'static Self {
        unsafe { NSURLAddedToDirectoryDateKey }
    }

    #[inline]
    pub fn quarantine_props() -> &'static Self {
        unsafe { NSURLQuarantinePropertiesKey }
    }

    #[inline]
    pub fn file_resource_type() -> &'static Self {
        unsafe { NSURLFileResourceTypeKey }
    }

    #[inline]
    pub fn file_id() -> &'static Self {
        unsafe { NSURLFileIdentifierKey }
    }

    #[inline]
    pub fn file_content_id() -> &'static Self {
        unsafe { NSURLFileContentIdentifierKey }
    }

    #[inline]
    pub fn may_share_file_content() -> &'static Self {
        unsafe { NSURLMayShareFileContentKey }
    }

    #[inline]
    pub fn may_hane_extended_attrs() -> &'static Self {
        unsafe { NSURLMayHaveExtendedAttributesKey }
    }

    #[inline]
    pub fn is_purgeable() -> &'static Self {
        unsafe { NSURLIsPurgeableKey }
    }

    #[inline]
    pub fn is_sparse() -> &'static Self {
        unsafe { NSURLIsSparseKey }
    }

    #[inline]
    pub fn directory_entry_count() -> &'static Self {
        unsafe { NSURLDirectoryEntryCountKey }
    }

    #[inline]
    pub fn volume_localized_format_desc() -> &'static Self {
        unsafe { NSURLVolumeLocalizedFormatDescriptionKey }
    }

    #[inline]
    pub fn volume_total_capacity() -> &'static Self {
        unsafe { NSURLVolumeTotalCapacityKey }
    }

    #[inline]
    pub fn volume_available_capacity() -> &'static Self {
        unsafe { NSURLVolumeAvailableCapacityKey }
    }

    #[inline]
    pub fn volume_resource_count() -> &'static Self {
        unsafe { NSURLVolumeResourceCountKey }
    }

    #[inline]
    pub fn volume_supports_persistent_ids() -> &'static Self {
        unsafe { NSURLVolumeSupportsPersistentIDsKey }
    }

    #[inline]
    pub fn volume_supports_symbolic_links() -> &'static Self {
        unsafe { NSURLVolumeSupportsSymbolicLinksKey }
    }

    #[inline]
    pub fn volume_supports_hard_links() -> &'static Self {
        unsafe { NSURLVolumeSupportsHardLinksKey }
    }

    #[inline]
    pub fn volume_supports_journaling() -> &'static Self {
        unsafe { NSURLVolumeSupportsJournalingKey }
    }

    #[inline]
    pub fn volume_is_journaling() -> &'static Self {
        unsafe { NSURLVolumeIsJournalingKey }
    }

    #[inline]
    pub fn volume_supports_sparce_files() -> &'static Self {
        unsafe { NSURLVolumeSupportsSparseFilesKey }
    }

    #[inline]
    pub fn volume_supports_zero_runs() -> &'static Self {
        unsafe { NSURLVolumeSupportsZeroRunsKey }
    }

    #[inline]
    pub fn volume_supports_case_sensitive_names() -> &'static Self {
        unsafe { NSURLVolumeSupportsCaseSensitiveNamesKey }
    }

    #[inline]
    pub fn volume_supports_case_preserved_names() -> &'static Self {
        unsafe { NSURLVolumeSupportsCasePreservedNamesKey }
    }

    #[inline]
    pub fn volume_supports_root_directory_dates() -> &'static Self {
        unsafe { NSURLVolumeSupportsRootDirectoryDatesKey }
    }

    #[inline]
    pub fn volume_supports_volume_sizes() -> &'static Self {
        unsafe { NSURLVolumeSupportsVolumeSizesKey }
    }

    #[inline]
    pub fn volume_supports_renaming() -> &'static Self {
        unsafe { NSURLVolumeSupportsRenamingKey }
    }

    #[inline]
    pub fn volume_supports_advisory_file_locking() -> &'static Self {
        unsafe { NSURLVolumeSupportsAdvisoryFileLockingKey }
    }

    #[inline]
    pub fn volume_supports_extended_security() -> &'static Self {
        unsafe { NSURLVolumeSupportsExtendedSecurityKey }
    }

    #[inline]
    pub fn volume_is_browsable() -> &'static Self {
        unsafe { NSURLVolumeIsBrowsableKey }
    }

    #[inline]
    pub fn volume_is_ejectable() -> &'static Self {
        unsafe { NSURLVolumeIsEjectableKey }
    }

    #[inline]
    pub fn volume_is_removable() -> &'static Self {
        unsafe { NSURLVolumeIsRemovableKey }
    }

    #[inline]
    pub fn volume_is_internal() -> &'static Self {
        unsafe { NSURLVolumeIsInternalKey }
    }

    #[inline]
    pub fn volume_is_automounted() -> &'static Self {
        unsafe { NSURLVolumeIsAutomountedKey }
    }

    #[inline]
    pub fn volume_is_local() -> &'static Self {
        unsafe { NSURLVolumeIsLocalKey }
    }

    #[inline]
    pub fn volume_is_read_only() -> &'static Self {
        unsafe { NSURLVolumeIsReadOnlyKey }
    }

    #[inline]
    pub fn volume_creation_date() -> &'static Self {
        unsafe { NSURLVolumeCreationDateKey }
    }

    #[inline]
    pub fn volume_url_for_remounting() -> &'static Self {
        unsafe { NSURLVolumeURLForRemountingKey }
    }

    #[inline]
    pub fn volume_uuid_string() -> &'static Self {
        unsafe { NSURLVolumeUUIDStringKey }
    }

    #[inline]
    pub fn volume_name() -> &'static Self {
        unsafe { NSURLVolumeNameKey }
    }

    #[inline]
    pub fn volume_localized_name() -> &'static Self {
        unsafe { NSURLVolumeLocalizedNameKey }
    }

    #[inline]
    pub fn volume_is_encrypted() -> &'static Self {
        unsafe { NSURLVolumeIsEncryptedKey }
    }

    #[inline]
    pub fn volume_is_root_file_system() -> &'static Self {
        unsafe { NSURLVolumeIsRootFileSystemKey }
    }
    #[inline]
    pub fn volume_supports_compression() -> &'static Self {
        unsafe { NSURLVolumeSupportsCompressionKey }
    }

    #[inline]
    pub fn volume_supports_file_cloning() -> &'static Self {
        unsafe { NSURLVolumeSupportsFileCloningKey }
    }

    #[inline]
    pub fn volume_supports_swap_renaming() -> &'static Self {
        unsafe { NSURLVolumeSupportsSwapRenamingKey }
    }

    #[inline]
    pub fn volume_supports_exclusive_renaming() -> &'static Self {
        unsafe { NSURLVolumeSupportsExclusiveRenamingKey }
    }

    #[inline]
    pub fn volume_supports_immutable_files() -> &'static Self {
        unsafe { NSURLVolumeSupportsImmutableFilesKey }
    }

    #[inline]
    pub fn volume_supports_access_permissions() -> &'static Self {
        unsafe { NSURLVolumeSupportsAccessPermissionsKey }
    }

    #[inline]
    pub fn volume_supports_file_protection() -> &'static Self {
        unsafe { NSURLVolumeSupportsFileProtectionKey }
    }

    #[inline]
    pub fn volume_available_capacity_for_important_usage() -> &'static Self {
        unsafe { NSURLVolumeAvailableCapacityForImportantUsageKey }
    }

    #[inline]
    pub fn volume_available_capacity_for_opportunistic_usage() -> &'static Self {
        unsafe { NSURLVolumeAvailableCapacityForOpportunisticUsageKey }
    }

    #[inline]
    pub fn volume_type_name() -> &'static Self {
        unsafe { NSURLVolumeTypeNameKey }
    }

    #[inline]
    pub fn volume_sub_type_name() -> &'static Self {
        unsafe { NSURLVolumeSubtypeKey }
    }

    #[inline]
    pub fn volume_mount_from_location() -> &'static Self {
        unsafe { NSURLVolumeMountFromLocationKey }
    }
}

#[link(name = "Foundation", kind = "framework")]
unsafe extern "C" {
    static NSURLNameKey: &'static ResKey;
    static NSURLLocalizedNameKey: &'static ResKey;
    static NSURLIsRegularFileKey: &'static ResKey;
    static NSURLIsDirectoryKey: &'static ResKey;
    static NSURLIsSymbolicLinkKey: &'static ResKey;
    static NSURLIsVolumeKey: &'static ResKey;
    static NSURLIsPackageKey: &'static ResKey;
    static NSURLIsApplicationKey: &'static ResKey;
    static NSURLApplicationIsScriptableKey: &'static ResKey;
    static NSURLIsSystemImmutableKey: &'static ResKey;
    static NSURLIsUserImmutableKey: &'static ResKey;
    static NSURLIsHiddenKey: &'static ResKey;
    static NSURLHasHiddenExtensionKey: &'static ResKey;
    static NSURLCreationDateKey: &'static ResKey;
    static NSURLContentAccessDateKey: &'static ResKey;
    static NSURLContentModificationDateKey: &'static ResKey;
    static NSURLAttributeModificationDateKey: &'static ResKey;
    static NSURLLinkCountKey: &'static ResKey;
    static NSURLParentDirectoryURLKey: &'static ResKey;
    static NSURLVolumeURLKey: &'static ResKey;
    static NSURLContentTypeKey: &'static ResKey;
    static NSURLLocalizedTypeDescriptionKey: &'static ResKey;
    static NSURLLabelNumberKey: &'static ResKey;
    static NSURLLabelColorKey: &'static ResKey;
    static NSURLLocalizedLabelKey: &'static ResKey;
    static NSURLEffectiveIconKey: &'static ResKey;
    static NSURLCustomIconKey: &'static ResKey;
    static NSURLFileResourceIdentifierKey: &'static ResKey;
    static NSURLVolumeIdentifierKey: &'static ResKey;
    static NSURLPreferredIOBlockSizeKey: &'static ResKey;
    static NSURLIsReadableKey: &'static ResKey;
    static NSURLIsWritableKey: &'static ResKey;
    static NSURLIsExecutableKey: &'static ResKey;
    static NSURLFileSecurityKey: &'static ResKey;
    static NSURLIsExcludedFromBackupKey: &'static ResKey;
    static NSURLTagNamesKey: &'static ResKey;
    static NSURLPathKey: &'static ResKey;
    static NSURLCanonicalPathKey: &'static ResKey;
    static NSURLIsMountTriggerKey: &'static ResKey;
    static NSURLGenerationIdentifierKey: &'static ResKey;
    static NSURLDocumentIdentifierKey: &'static ResKey;
    static NSURLAddedToDirectoryDateKey: &'static ResKey;
    static NSURLQuarantinePropertiesKey: &'static ResKey;
    static NSURLFileResourceTypeKey: &'static ResKey;
    static NSURLFileIdentifierKey: &'static ResKey;
    static NSURLFileContentIdentifierKey: &'static ResKey;
    static NSURLMayShareFileContentKey: &'static ResKey;
    static NSURLMayHaveExtendedAttributesKey: &'static ResKey;
    static NSURLIsPurgeableKey: &'static ResKey;
    static NSURLIsSparseKey: &'static ResKey;
    static NSURLDirectoryEntryCountKey: &'static ResKey;
    static NSURLVolumeLocalizedFormatDescriptionKey: &'static ResKey;
    static NSURLVolumeTotalCapacityKey: &'static ResKey;
    static NSURLVolumeAvailableCapacityKey: &'static ResKey;
    static NSURLVolumeResourceCountKey: &'static ResKey;
    static NSURLVolumeSupportsPersistentIDsKey: &'static ResKey;
    static NSURLVolumeSupportsSymbolicLinksKey: &'static ResKey;
    static NSURLVolumeSupportsHardLinksKey: &'static ResKey;
    static NSURLVolumeSupportsJournalingKey: &'static ResKey;
    static NSURLVolumeIsJournalingKey: &'static ResKey;
    static NSURLVolumeSupportsSparseFilesKey: &'static ResKey;
    static NSURLVolumeSupportsZeroRunsKey: &'static ResKey;
    static NSURLVolumeSupportsCaseSensitiveNamesKey: &'static ResKey;
    static NSURLVolumeSupportsCasePreservedNamesKey: &'static ResKey;
    static NSURLVolumeSupportsRootDirectoryDatesKey: &'static ResKey;
    static NSURLVolumeSupportsVolumeSizesKey: &'static ResKey;
    static NSURLVolumeSupportsRenamingKey: &'static ResKey;
    static NSURLVolumeSupportsAdvisoryFileLockingKey: &'static ResKey;
    static NSURLVolumeSupportsExtendedSecurityKey: &'static ResKey;
    static NSURLVolumeIsBrowsableKey: &'static ResKey;
    static NSURLVolumeIsEjectableKey: &'static ResKey;
    static NSURLVolumeIsRemovableKey: &'static ResKey;
    static NSURLVolumeIsInternalKey: &'static ResKey;
    static NSURLVolumeIsAutomountedKey: &'static ResKey;
    static NSURLVolumeIsLocalKey: &'static ResKey;
    static NSURLVolumeIsReadOnlyKey: &'static ResKey;
    static NSURLVolumeCreationDateKey: &'static ResKey;
    static NSURLVolumeURLForRemountingKey: &'static ResKey;
    static NSURLVolumeUUIDStringKey: &'static ResKey;
    static NSURLVolumeNameKey: &'static ResKey;
    static NSURLVolumeLocalizedNameKey: &'static ResKey;
    static NSURLVolumeIsEncryptedKey: &'static ResKey;
    static NSURLVolumeIsRootFileSystemKey: &'static ResKey;
    static NSURLVolumeSupportsCompressionKey: &'static ResKey;
    static NSURLVolumeSupportsFileCloningKey: &'static ResKey;
    static NSURLVolumeSupportsSwapRenamingKey: &'static ResKey;
    static NSURLVolumeSupportsExclusiveRenamingKey: &'static ResKey;
    static NSURLVolumeSupportsImmutableFilesKey: &'static ResKey;
    static NSURLVolumeSupportsAccessPermissionsKey: &'static ResKey;
    static NSURLVolumeSupportsFileProtectionKey: &'static ResKey;
    static NSURLVolumeAvailableCapacityForImportantUsageKey: &'static ResKey;
    static NSURLVolumeAvailableCapacityForOpportunisticUsageKey: &'static ResKey;
    static NSURLVolumeTypeNameKey: &'static ResKey;
    static NSURLVolumeSubtypeKey: &'static ResKey;
    static NSURLVolumeMountFromLocationKey: &'static ResKey;
}

#[cfg(test)]
mod tests {
    use crate::ns;

    #[test]
    fn basics() {
        let url = ns::Url::with_fs_path_str("/tmp", true);
        let abs_str = url.abs_string().unwrap();

        let url2 = ns::Url::with_str("file:///tmp/").unwrap();
        let abs_str2 = url2.abs_string().unwrap();

        assert!(abs_str.eq(&abs_str2));
    }
}