objc2_core_services/generated/Metadata/
MDLabel.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10
11use crate::*;
12
13/// This is the type of a reference to an MDLabel.
14///
15/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/mdlabel?language=objc)
16#[doc(alias = "MDLabelRef")]
17#[repr(C)]
18pub struct MDLabel {
19    inner: [u8; 0],
20    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
21}
22
23cf_type!(
24    unsafe impl MDLabel {}
25);
26#[cfg(feature = "objc2")]
27cf_objc2_type!(
28    unsafe impl RefEncode<"__MDLabel"> for MDLabel {}
29);
30
31unsafe impl ConcreteType for MDLabel {
32    #[doc(alias = "MDLabelGetTypeID")]
33    #[inline]
34    fn type_id() -> CFTypeID {
35        extern "C-unwind" {
36            fn MDLabelGetTypeID() -> CFTypeID;
37        }
38        unsafe { MDLabelGetTypeID() }
39    }
40}
41
42#[cfg(feature = "MDItem")]
43impl MDItem {
44    /// Returns an array of the labels set on the specified item.
45    ///
46    /// Parameter `item`: The item to be interrogated.
47    ///
48    /// Returns: A CFArrayRef containing MDLabelRefs for the labels set on the item, or NULL on failure.
49    #[doc(alias = "MDItemCopyLabels")]
50    #[cfg(feature = "MDItem")]
51    #[inline]
52    pub unsafe fn labels(&self) -> Option<CFRetained<CFArray>> {
53        extern "C-unwind" {
54            fn MDItemCopyLabels(item: &MDItem) -> Option<NonNull<CFArray>>;
55        }
56        let ret = unsafe { MDItemCopyLabels(self) };
57        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
58    }
59
60    /// Sets a label on the specified item.
61    ///
62    /// Parameter `item`: The item to be updated.
63    ///
64    /// Parameter `label`: The label.
65    ///
66    /// Returns: True if the label was successfully set on the item, false otherwise.
67    ///
68    /// # Safety
69    ///
70    /// `label` might not allow `None`.
71    #[doc(alias = "MDItemSetLabel")]
72    #[cfg(feature = "MDItem")]
73    #[inline]
74    pub unsafe fn set_label(&self, label: Option<&MDLabel>) -> bool {
75        extern "C-unwind" {
76            fn MDItemSetLabel(item: &MDItem, label: Option<&MDLabel>) -> Boolean;
77        }
78        let ret = unsafe { MDItemSetLabel(self, label) };
79        ret != 0
80    }
81
82    /// Removes a label from the specified item.
83    ///
84    /// Parameter `item`: The item to be updated.
85    ///
86    /// Parameter `label`: The label.
87    ///
88    /// Returns: True if the label was successfully removed from the item, false otherwise.
89    ///
90    /// # Safety
91    ///
92    /// `label` might not allow `None`.
93    #[doc(alias = "MDItemRemoveLabel")]
94    #[cfg(feature = "MDItem")]
95    #[inline]
96    pub unsafe fn remove_label(&self, label: Option<&MDLabel>) -> bool {
97        extern "C-unwind" {
98            fn MDItemRemoveLabel(item: &MDItem, label: Option<&MDLabel>) -> Boolean;
99        }
100        let ret = unsafe { MDItemRemoveLabel(self, label) };
101        ret != 0
102    }
103}
104
105/// These constants are used to specify a domain to MDLabelCreate().
106///
107/// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/mdlabeldomain?language=objc)
108#[repr(transparent)]
109#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
110pub struct MDLabelDomain(pub c_uint);
111impl MDLabelDomain {
112    #[doc(alias = "kMDLabelUserDomain")]
113    pub const UserDomain: Self = Self(0);
114    #[doc(alias = "kMDLabelLocalDomain")]
115    pub const LocalDomain: Self = Self(1);
116}
117
118#[cfg(feature = "objc2")]
119unsafe impl Encode for MDLabelDomain {
120    const ENCODING: Encoding = c_uint::ENCODING;
121}
122
123#[cfg(feature = "objc2")]
124unsafe impl RefEncode for MDLabelDomain {
125    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
126}
127
128impl MDLabel {
129    /// Returns a label with the specified parameters. If there is already a label that exactly matches the parameters, a reference to the existing label will be returned; otherwise this will attempt to create a new label.  A successful creation of a new private label definition will generate a kMDLabelAddedNotification. Note that this function can only create labels with "Private" visibility. Creating "Public" labels requires creating and installing a label bundle.
130    ///
131    /// Parameter `allocator`: The CFAllocator which should be used to allocate memory for the label. This parameter may be NULL in which case the current default CFAllocator is used. Use kCFAllocatorNull to request a reference to an existing label only.
132    ///
133    /// Parameter `displayName`: The label's display name.
134    ///
135    /// Parameter `kind`: The label's kind string.
136    ///
137    /// Parameter `domain`: The domain of the label (normally kMDLabelUserDomain).
138    ///
139    /// Returns: An MDLabelRef, or NULL on failure.
140    ///
141    /// # Safety
142    ///
143    /// - `allocator` might not allow `None`.
144    /// - `display_name` might not allow `None`.
145    /// - `kind` might not allow `None`.
146    #[doc(alias = "MDLabelCreate")]
147    #[inline]
148    pub unsafe fn new(
149        allocator: Option<&CFAllocator>,
150        display_name: Option<&CFString>,
151        kind: Option<&CFString>,
152        domain: MDLabelDomain,
153    ) -> Option<CFRetained<MDLabel>> {
154        extern "C-unwind" {
155            fn MDLabelCreate(
156                allocator: Option<&CFAllocator>,
157                display_name: Option<&CFString>,
158                kind: Option<&CFString>,
159                domain: MDLabelDomain,
160            ) -> Option<NonNull<MDLabel>>;
161        }
162        let ret = unsafe { MDLabelCreate(allocator, display_name, kind, domain) };
163        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
164    }
165
166    /// Copy the value of the named attribute of a label.
167    ///
168    /// Parameter `label`: The label.
169    ///
170    /// Parameter `name`: The name of the desired attribute.
171    ///
172    /// Returns: A CFTypeRef, or NULL on failure, or if the attribute does not exist, or if the attribute is not readable.
173    ///
174    /// # Safety
175    ///
176    /// `name` might not allow `None`.
177    #[doc(alias = "MDLabelCopyAttribute")]
178    #[inline]
179    pub unsafe fn attribute(&self, name: Option<&CFString>) -> Option<CFRetained<CFType>> {
180        extern "C-unwind" {
181            fn MDLabelCopyAttribute(
182                label: &MDLabel,
183                name: Option<&CFString>,
184            ) -> Option<NonNull<CFType>>;
185        }
186        let ret = unsafe { MDLabelCopyAttribute(self, name) };
187        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
188    }
189
190    /// Copy the MDItem attribute name of a label. The attribute name can be used in an MDQuery string to search for MDItems that have the label set. The value of the MDItem attribute is a CFDate corresponding to the time the label was set on the item.
191    ///
192    /// Parameter `label`: The label.
193    ///
194    /// Returns: A CFStringRef, or NULL on failure.
195    #[doc(alias = "MDLabelCopyAttributeName")]
196    #[inline]
197    pub unsafe fn attribute_name(&self) -> Option<CFRetained<CFString>> {
198        extern "C-unwind" {
199            fn MDLabelCopyAttributeName(label: &MDLabel) -> Option<NonNull<CFString>>;
200        }
201        let ret = unsafe { MDLabelCopyAttributeName(self) };
202        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
203    }
204
205    /// Deletes the user's definition or override of the specified label from ~/Library/Metadata. Labels defined in bundles elsewhere in the filesystem cannot be deleted using this API. Deleting an override of a label merely makes the original definition of the label visible again and thus will generate a kMDLabelChangedNotification. A successful deletion of a private label definition will generate a kMDLabelRemovedNotification.
206    ///
207    /// Parameter `label`: The label.
208    ///
209    /// Returns: True if a label definition or override was successfully deleted.
210    #[doc(alias = "MDLabelDelete")]
211    #[inline]
212    pub unsafe fn delete(&self) -> bool {
213        extern "C-unwind" {
214            fn MDLabelDelete(label: &MDLabel) -> Boolean;
215        }
216        let ret = unsafe { MDLabelDelete(self) };
217        ret != 0
218    }
219
220    /// Updates the attributes of the specified label. Labels defined in ~/Library/Metadata are modified directly. Labels defined in bundles elsewhere in the filesystem are overridden by creating a private copy of the label definition in ~/Library/Metadata. The updated attributes are then stored in the private copy. A successful call to MDLabelSetAttributes() will generate a kMDLabelChangedNotification.
221    ///
222    /// Parameter `label`: The label.
223    ///
224    /// Parameter `attrs`: A dictionary containing the attributes to be modified. To remove an attribute, include it in the dictionary with kCFNull as its value.
225    ///
226    /// Returns: True if the label definition or override was successfully updated.
227    ///
228    /// # Safety
229    ///
230    /// - `attrs` generics must be of the correct type.
231    /// - `attrs` might not allow `None`.
232    #[doc(alias = "MDLabelSetAttributes")]
233    #[inline]
234    pub unsafe fn set_attributes(&self, attrs: Option<&CFDictionary>) -> bool {
235        extern "C-unwind" {
236            fn MDLabelSetAttributes(label: &MDLabel, attrs: Option<&CFDictionary>) -> Boolean;
237        }
238        let ret = unsafe { MDLabelSetAttributes(self, attrs) };
239        ret != 0
240    }
241}
242
243/// Copy the list of label kind strings.
244///
245/// Returns: A CFArrayRef containing all of the label kind strings, or NULL on failure.
246#[inline]
247pub unsafe extern "C-unwind" fn MDCopyLabelKinds() -> Option<CFRetained<CFArray>> {
248    extern "C-unwind" {
249        fn MDCopyLabelKinds() -> Option<NonNull<CFArray>>;
250    }
251    let ret = unsafe { MDCopyLabelKinds() };
252    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
253}
254
255/// Copy the list of labels matching the specified query expression.
256///
257/// Parameter `simpleQueryString`: The query expression string.
258///
259/// Returns: A CFArrayRef containing all of the matching labels, or NULL on failure.
260///
261/// # Safety
262///
263/// `simple_query_string` might not allow `None`.
264#[inline]
265pub unsafe extern "C-unwind" fn MDCopyLabelsMatchingExpression(
266    simple_query_string: Option<&CFString>,
267) -> Option<CFRetained<CFArray>> {
268    extern "C-unwind" {
269        fn MDCopyLabelsMatchingExpression(
270            simple_query_string: Option<&CFString>,
271        ) -> Option<NonNull<CFArray>>;
272    }
273    let ret = unsafe { MDCopyLabelsMatchingExpression(simple_query_string) };
274    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
275}
276
277/// Copy the list of labels with the specified kind string.
278///
279/// Parameter `kind`: The kind string, or NULL to copy all labels.
280///
281/// Returns: A CFArrayRef containing all of the labels with the specified kind string, or NULL on failure.
282///
283/// # Safety
284///
285/// `kind` might not allow `None`.
286#[inline]
287pub unsafe extern "C-unwind" fn MDCopyLabelsWithKind(
288    kind: Option<&CFString>,
289) -> Option<CFRetained<CFArray>> {
290    extern "C-unwind" {
291        fn MDCopyLabelsWithKind(kind: Option<&CFString>) -> Option<NonNull<CFArray>>;
292    }
293    let ret = unsafe { MDCopyLabelsWithKind(kind) };
294    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
295}
296
297/// Copy the label with the specified UUID.
298///
299/// Parameter `labelUUID`: The label UUID.
300///
301/// Returns: An MDLabelRef, or NULL on failure.
302///
303/// # Safety
304///
305/// `label_uuid` might not allow `None`.
306#[inline]
307pub unsafe extern "C-unwind" fn MDCopyLabelWithUUID(
308    label_uuid: Option<&CFUUID>,
309) -> Option<CFRetained<MDLabel>> {
310    extern "C-unwind" {
311        fn MDCopyLabelWithUUID(label_uuid: Option<&CFUUID>) -> Option<NonNull<MDLabel>>;
312    }
313    let ret = unsafe { MDCopyLabelWithUUID(label_uuid) };
314    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
315}
316
317extern "C" {
318    /// This is the bundle URL for the label.
319    /// Type is a CFURL. This attribute is read-only.
320    ///
321    ///
322    ///
323    /// This is the date the the label content last changed.
324    /// Type is a CFDate. This attribute is read-only, but its value will be altered by setting any of the writable attributes described below.
325    ///
326    ///
327    ///
328    /// This is the localized name of the label.
329    /// Type is a CFString.
330    ///
331    ///
332    ///
333    /// This is the data that should be used to create an icon image source for the label. Pass this data to the ImageIO framework to create a CGImageSourceRef. To reset a label's icon to its default image, set kMDLabelIconData to kCFNull.
334    /// Type is a CFData.
335    ///
336    ///
337    ///
338    /// This is the UUID of the icon image source for the label. Labels that share the same icon image source will have the same icon UUID.
339    /// Type is a CFUUID. This attribute is read-only, but its value may be altered by setting the kMDLabelIconData attribute described above.
340    ///
341    ///
342    ///
343    /// This attribute is true if the label kind specifies a mutually-exclusive set of labels.
344    /// Type is a CFBoolean. This attribute is read-only.
345    ///
346    ///
347    ///
348    /// This is the kind string for the label. The label kind is the name of the bundle the label is defined in.
349    /// Type is a CFString. This attribute is read-only.
350    ///
351    ///
352    ///
353    /// This attribute is optional and applicable only to labels with "Public" visibility. If it is present, then when the label is set on a file the file's Finder color will be set to the specified value (0 - 7). If the label is later removed, the file's Finder color will be reverted either to the color specified by the most-recently-set label with this attribute that remains set on the file, or to 0 (none).
354    /// Type is a CFNumber. This attribute is ignored for unless the label's visibility is "Public".
355    ///
356    ///
357    ///
358    /// This is the UUID of the label.
359    /// Type is a CFUUID. This attribute is read-only.
360    ///
361    ///
362    ///
363    /// This is a constant describing the label's visibility, either "Public" (kMDPublicVisibility) or "Private" (kMDPrivateVisibility).
364    /// Type is a CFString. This attribute is read-only.
365    ///
366    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdlabelbundleurl?language=objc)
367    pub static kMDLabelBundleURL: Option<&'static CFString>;
368}
369
370extern "C" {
371    /// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdlabelcontentchangedate?language=objc)
372    pub static kMDLabelContentChangeDate: Option<&'static CFString>;
373}
374
375extern "C" {
376    /// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdlabeldisplayname?language=objc)
377    pub static kMDLabelDisplayName: Option<&'static CFString>;
378}
379
380extern "C" {
381    /// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdlabelicondata?language=objc)
382    pub static kMDLabelIconData: Option<&'static CFString>;
383}
384
385extern "C" {
386    /// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdlabeliconuuid?language=objc)
387    pub static kMDLabelIconUUID: Option<&'static CFString>;
388}
389
390extern "C" {
391    /// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdlabelismutuallyexclusivesetmember?language=objc)
392    pub static kMDLabelIsMutuallyExclusiveSetMember: Option<&'static CFString>;
393}
394
395extern "C" {
396    /// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdlabelkind?language=objc)
397    pub static kMDLabelKind: Option<&'static CFString>;
398}
399
400extern "C" {
401    /// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdlabelsetsfindercolor?language=objc)
402    pub static kMDLabelSetsFinderColor: Option<&'static CFString>;
403}
404
405extern "C" {
406    /// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdlabeluuid?language=objc)
407    pub static kMDLabelUUID: Option<&'static CFString>;
408}
409
410extern "C" {
411    /// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdlabelvisibility?language=objc)
412    pub static kMDLabelVisibility: Option<&'static CFString>;
413}
414
415extern "C" {
416    /// This key is used in the Info.plist file of a label bundle to specify that the label kind constitutes a mutually exclusive set.
417    /// The value is a CFBoolean.
418    ///
419    ///
420    ///
421    /// This key is used in the Info.plist file of a label bundle to specify the visibility of the labels defined by the bundle.
422    /// The value is a CFString constant, either "Public" (kMDPublicVisibility) or "Private" (kMDPrivateVisibility).
423    ///
424    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdlabelkindismutuallyexclusivesetkey?language=objc)
425    pub static kMDLabelKindIsMutuallyExclusiveSetKey: Option<&'static CFString>;
426}
427
428extern "C" {
429    /// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdlabelkindvisibilitykey?language=objc)
430    pub static kMDLabelKindVisibilityKey: Option<&'static CFString>;
431}
432
433extern "C" {
434    /// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdprivatevisibility?language=objc)
435    pub static kMDPrivateVisibility: Option<&'static CFString>;
436}
437
438extern "C" {
439    /// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdpublicvisibility?language=objc)
440    pub static kMDPublicVisibility: Option<&'static CFString>;
441}
442
443extern "C" {
444    /// The name of the notification sent when a label has been added. The notification object is the subject MDLabelRef. All label notifications are distributed to processes owned by the same uid that have initialized the Metadata framework label APIs.
445    ///
446    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdlabeladdednotification?language=objc)
447    pub static kMDLabelAddedNotification: Option<&'static CFString>;
448}
449
450extern "C" {
451    /// The name of the notification sent when a label has been changed. The notification object is the subject MDLabelRef. The label's new attributes can be retrieved using MDLabelCopyAttribute().
452    ///
453    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdlabelchangednotification?language=objc)
454    pub static kMDLabelChangedNotification: Option<&'static CFString>;
455}
456
457extern "C" {
458    /// The name of the notification sent when a label has been deleted. The notification object is the subject MDLabelRef. The label's kMDLabelIconUUID, kMDLabelKind, kMDLabelKindBundleURL and kMDLabelUUID attributes can still be retrieved using MDLabelCopyAttribute(), and the label may still be passed to MDLabelCopyAttributeName().
459    ///
460    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreservices/kmdlabelremovednotification?language=objc)
461    pub static kMDLabelRemovedNotification: Option<&'static CFString>;
462}
463
464#[cfg(feature = "MDItem")]
465#[deprecated = "renamed to `MDItem::labels`"]
466#[inline]
467pub unsafe extern "C-unwind" fn MDItemCopyLabels(item: &MDItem) -> Option<CFRetained<CFArray>> {
468    extern "C-unwind" {
469        fn MDItemCopyLabels(item: &MDItem) -> Option<NonNull<CFArray>>;
470    }
471    let ret = unsafe { MDItemCopyLabels(item) };
472    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
473}
474
475#[cfg(feature = "MDItem")]
476#[deprecated = "renamed to `MDItem::set_label`"]
477#[inline]
478pub unsafe extern "C-unwind" fn MDItemSetLabel(item: &MDItem, label: Option<&MDLabel>) -> bool {
479    extern "C-unwind" {
480        fn MDItemSetLabel(item: &MDItem, label: Option<&MDLabel>) -> Boolean;
481    }
482    let ret = unsafe { MDItemSetLabel(item, label) };
483    ret != 0
484}
485
486#[cfg(feature = "MDItem")]
487#[deprecated = "renamed to `MDItem::remove_label`"]
488#[inline]
489pub unsafe extern "C-unwind" fn MDItemRemoveLabel(item: &MDItem, label: Option<&MDLabel>) -> bool {
490    extern "C-unwind" {
491        fn MDItemRemoveLabel(item: &MDItem, label: Option<&MDLabel>) -> Boolean;
492    }
493    let ret = unsafe { MDItemRemoveLabel(item, label) };
494    ret != 0
495}
496
497#[deprecated = "renamed to `MDLabel::new`"]
498#[inline]
499pub unsafe extern "C-unwind" fn MDLabelCreate(
500    allocator: Option<&CFAllocator>,
501    display_name: Option<&CFString>,
502    kind: Option<&CFString>,
503    domain: MDLabelDomain,
504) -> Option<CFRetained<MDLabel>> {
505    extern "C-unwind" {
506        fn MDLabelCreate(
507            allocator: Option<&CFAllocator>,
508            display_name: Option<&CFString>,
509            kind: Option<&CFString>,
510            domain: MDLabelDomain,
511        ) -> Option<NonNull<MDLabel>>;
512    }
513    let ret = unsafe { MDLabelCreate(allocator, display_name, kind, domain) };
514    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
515}
516
517#[deprecated = "renamed to `MDLabel::attribute`"]
518#[inline]
519pub unsafe extern "C-unwind" fn MDLabelCopyAttribute(
520    label: &MDLabel,
521    name: Option<&CFString>,
522) -> Option<CFRetained<CFType>> {
523    extern "C-unwind" {
524        fn MDLabelCopyAttribute(
525            label: &MDLabel,
526            name: Option<&CFString>,
527        ) -> Option<NonNull<CFType>>;
528    }
529    let ret = unsafe { MDLabelCopyAttribute(label, name) };
530    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
531}
532
533#[deprecated = "renamed to `MDLabel::attribute_name`"]
534#[inline]
535pub unsafe extern "C-unwind" fn MDLabelCopyAttributeName(
536    label: &MDLabel,
537) -> Option<CFRetained<CFString>> {
538    extern "C-unwind" {
539        fn MDLabelCopyAttributeName(label: &MDLabel) -> Option<NonNull<CFString>>;
540    }
541    let ret = unsafe { MDLabelCopyAttributeName(label) };
542    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
543}
544
545#[deprecated = "renamed to `MDLabel::delete`"]
546#[inline]
547pub unsafe extern "C-unwind" fn MDLabelDelete(label: &MDLabel) -> bool {
548    extern "C-unwind" {
549        fn MDLabelDelete(label: &MDLabel) -> Boolean;
550    }
551    let ret = unsafe { MDLabelDelete(label) };
552    ret != 0
553}
554
555#[deprecated = "renamed to `MDLabel::set_attributes`"]
556#[inline]
557pub unsafe extern "C-unwind" fn MDLabelSetAttributes(
558    label: &MDLabel,
559    attrs: Option<&CFDictionary>,
560) -> bool {
561    extern "C-unwind" {
562        fn MDLabelSetAttributes(label: &MDLabel, attrs: Option<&CFDictionary>) -> Boolean;
563    }
564    let ret = unsafe { MDLabelSetAttributes(label, attrs) };
565    ret != 0
566}