objc2_ui_kit/generated/
NSAttributedString.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 "C" {
11    /// ********************** Attributes ***********************
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/nsfontattributename?language=objc)
14    pub static NSFontAttributeName: &'static NSAttributedStringKey;
15}
16
17extern "C" {
18    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsparagraphstyleattributename?language=objc)
19    pub static NSParagraphStyleAttributeName: &'static NSAttributedStringKey;
20}
21
22extern "C" {
23    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsforegroundcolorattributename?language=objc)
24    pub static NSForegroundColorAttributeName: &'static NSAttributedStringKey;
25}
26
27extern "C" {
28    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsbackgroundcolorattributename?language=objc)
29    pub static NSBackgroundColorAttributeName: &'static NSAttributedStringKey;
30}
31
32extern "C" {
33    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsligatureattributename?language=objc)
34    pub static NSLigatureAttributeName: &'static NSAttributedStringKey;
35}
36
37extern "C" {
38    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nskernattributename?language=objc)
39    pub static NSKernAttributeName: &'static NSAttributedStringKey;
40}
41
42extern "C" {
43    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstrackingattributename?language=objc)
44    pub static NSTrackingAttributeName: &'static NSAttributedStringKey;
45}
46
47extern "C" {
48    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsstrikethroughstyleattributename?language=objc)
49    pub static NSStrikethroughStyleAttributeName: &'static NSAttributedStringKey;
50}
51
52extern "C" {
53    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsunderlinestyleattributename?language=objc)
54    pub static NSUnderlineStyleAttributeName: &'static NSAttributedStringKey;
55}
56
57extern "C" {
58    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsstrokecolorattributename?language=objc)
59    pub static NSStrokeColorAttributeName: &'static NSAttributedStringKey;
60}
61
62extern "C" {
63    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsstrokewidthattributename?language=objc)
64    pub static NSStrokeWidthAttributeName: &'static NSAttributedStringKey;
65}
66
67extern "C" {
68    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsshadowattributename?language=objc)
69    pub static NSShadowAttributeName: &'static NSAttributedStringKey;
70}
71
72extern "C" {
73    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstexteffectattributename?language=objc)
74    pub static NSTextEffectAttributeName: &'static NSAttributedStringKey;
75}
76
77extern "C" {
78    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsattachmentattributename?language=objc)
79    pub static NSAttachmentAttributeName: &'static NSAttributedStringKey;
80}
81
82extern "C" {
83    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nslinkattributename?language=objc)
84    pub static NSLinkAttributeName: &'static NSAttributedStringKey;
85}
86
87extern "C" {
88    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsbaselineoffsetattributename?language=objc)
89    pub static NSBaselineOffsetAttributeName: &'static NSAttributedStringKey;
90}
91
92extern "C" {
93    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsunderlinecolorattributename?language=objc)
94    pub static NSUnderlineColorAttributeName: &'static NSAttributedStringKey;
95}
96
97extern "C" {
98    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsstrikethroughcolorattributename?language=objc)
99    pub static NSStrikethroughColorAttributeName: &'static NSAttributedStringKey;
100}
101
102extern "C" {
103    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nswritingdirectionattributename?language=objc)
104    pub static NSWritingDirectionAttributeName: &'static NSAttributedStringKey;
105}
106
107extern "C" {
108    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstexthighlightstyleattributename?language=objc)
109    pub static NSTextHighlightStyleAttributeName: &'static NSAttributedStringKey;
110}
111
112extern "C" {
113    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstexthighlightcolorschemeattributename?language=objc)
114    pub static NSTextHighlightColorSchemeAttributeName: &'static NSAttributedStringKey;
115}
116
117extern "C" {
118    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsadaptiveimageglyphattributename?language=objc)
119    pub static NSAdaptiveImageGlyphAttributeName: &'static NSAttributedStringKey;
120}
121
122extern "C" {
123    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nswritingtoolsexclusionattributename?language=objc)
124    pub static NSWritingToolsExclusionAttributeName: &'static NSAttributedStringKey;
125}
126
127/// ********************** Attribute values ***********************
128///
129/// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/nsunderlinestyle?language=objc)
130// NS_OPTIONS
131#[repr(transparent)]
132#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
133pub struct NSUnderlineStyle(pub NSInteger);
134bitflags::bitflags! {
135    impl NSUnderlineStyle: NSInteger {
136        #[doc(alias = "NSUnderlineStyleNone")]
137        const None = 0x00;
138        #[doc(alias = "NSUnderlineStyleSingle")]
139        const Single = 0x01;
140        #[doc(alias = "NSUnderlineStyleThick")]
141        const Thick = 0x02;
142        #[doc(alias = "NSUnderlineStyleDouble")]
143        const Double = 0x09;
144        #[doc(alias = "NSUnderlineStylePatternSolid")]
145        const PatternSolid = 0x0000;
146        #[doc(alias = "NSUnderlineStylePatternDot")]
147        const PatternDot = 0x0100;
148        #[doc(alias = "NSUnderlineStylePatternDash")]
149        const PatternDash = 0x0200;
150        #[doc(alias = "NSUnderlineStylePatternDashDot")]
151        const PatternDashDot = 0x0300;
152        #[doc(alias = "NSUnderlineStylePatternDashDotDot")]
153        const PatternDashDotDot = 0x0400;
154        #[doc(alias = "NSUnderlineStyleByWord")]
155        const ByWord = 0x8000;
156    }
157}
158
159unsafe impl Encode for NSUnderlineStyle {
160    const ENCODING: Encoding = NSInteger::ENCODING;
161}
162
163unsafe impl RefEncode for NSUnderlineStyle {
164    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
165}
166
167/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nswritingdirectionformattype?language=objc)
168// NS_ENUM
169#[repr(transparent)]
170#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
171pub struct NSWritingDirectionFormatType(pub NSInteger);
172impl NSWritingDirectionFormatType {
173    #[doc(alias = "NSWritingDirectionEmbedding")]
174    pub const Embedding: Self = Self(0 << 1);
175    #[doc(alias = "NSWritingDirectionOverride")]
176    pub const Override: Self = Self(1 << 1);
177}
178
179unsafe impl Encode for NSWritingDirectionFormatType {
180    const ENCODING: Encoding = NSInteger::ENCODING;
181}
182
183unsafe impl RefEncode for NSWritingDirectionFormatType {
184    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
185}
186
187/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstexteffectstyle?language=objc)
188// NS_TYPED_ENUM
189pub type NSTextEffectStyle = NSString;
190
191extern "C" {
192    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstexteffectletterpressstyle?language=objc)
193    pub static NSTextEffectLetterpressStyle: &'static NSTextEffectStyle;
194}
195
196/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstexthighlightstyle?language=objc)
197// NS_TYPED_EXTENSIBLE_ENUM
198pub type NSTextHighlightStyle = NSString;
199
200extern "C" {
201    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstexthighlightstyledefault?language=objc)
202    pub static NSTextHighlightStyleDefault: &'static NSTextHighlightStyle;
203}
204
205/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstexthighlightcolorscheme?language=objc)
206// NS_TYPED_EXTENSIBLE_ENUM
207pub type NSTextHighlightColorScheme = NSString;
208
209extern "C" {
210    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstexthighlightcolorschemedefault?language=objc)
211    pub static NSTextHighlightColorSchemeDefault: &'static NSTextHighlightColorScheme;
212}
213
214extern "C" {
215    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstexthighlightcolorschemepurple?language=objc)
216    pub static NSTextHighlightColorSchemePurple: &'static NSTextHighlightColorScheme;
217}
218
219extern "C" {
220    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstexthighlightcolorschemepink?language=objc)
221    pub static NSTextHighlightColorSchemePink: &'static NSTextHighlightColorScheme;
222}
223
224extern "C" {
225    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstexthighlightcolorschemeorange?language=objc)
226    pub static NSTextHighlightColorSchemeOrange: &'static NSTextHighlightColorScheme;
227}
228
229extern "C" {
230    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstexthighlightcolorschememint?language=objc)
231    pub static NSTextHighlightColorSchemeMint: &'static NSTextHighlightColorScheme;
232}
233
234extern "C" {
235    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstexthighlightcolorschemeblue?language=objc)
236    pub static NSTextHighlightColorSchemeBlue: &'static NSTextHighlightColorScheme;
237}
238
239mod private_NSAttributedStringAttributeFixing {
240    pub trait Sealed {}
241}
242
243/// Category on [`NSMutableAttributedString`].
244///
245/// ********************** Attribute fixing ***********************
246pub unsafe trait NSAttributedStringAttributeFixing:
247    ClassType + Sized + private_NSAttributedStringAttributeFixing::Sealed
248{
249    extern_methods!(
250        #[unsafe(method(fixAttributesInRange:))]
251        #[unsafe(method_family = none)]
252        fn fixAttributesInRange(&self, range: NSRange);
253    );
254}
255
256impl private_NSAttributedStringAttributeFixing::Sealed for NSMutableAttributedString {}
257unsafe impl NSAttributedStringAttributeFixing for NSMutableAttributedString {}
258
259/// ********************** Document formats ***********************
260///
261/// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/nsattributedstringdocumenttype?language=objc)
262// NS_TYPED_EXTENSIBLE_ENUM
263pub type NSAttributedStringDocumentType = NSString;
264
265extern "C" {
266    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsplaintextdocumenttype?language=objc)
267    pub static NSPlainTextDocumentType: &'static NSAttributedStringDocumentType;
268}
269
270extern "C" {
271    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsrtftextdocumenttype?language=objc)
272    pub static NSRTFTextDocumentType: &'static NSAttributedStringDocumentType;
273}
274
275extern "C" {
276    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsrtfdtextdocumenttype?language=objc)
277    pub static NSRTFDTextDocumentType: &'static NSAttributedStringDocumentType;
278}
279
280extern "C" {
281    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nshtmltextdocumenttype?language=objc)
282    pub static NSHTMLTextDocumentType: &'static NSAttributedStringDocumentType;
283}
284
285/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstextlayoutsectionkey?language=objc)
286// NS_TYPED_ENUM
287pub type NSTextLayoutSectionKey = NSString;
288
289extern "C" {
290    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstextlayoutsectionorientation?language=objc)
291    pub static NSTextLayoutSectionOrientation: &'static NSTextLayoutSectionKey;
292}
293
294extern "C" {
295    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstextlayoutsectionrange?language=objc)
296    pub static NSTextLayoutSectionRange: &'static NSTextLayoutSectionKey;
297}
298
299/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstextscalingtype?language=objc)
300// NS_ENUM
301#[repr(transparent)]
302#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
303pub struct NSTextScalingType(pub NSInteger);
304impl NSTextScalingType {
305    #[doc(alias = "NSTextScalingStandard")]
306    pub const ScalingStandard: Self = Self(0);
307    #[doc(alias = "NSTextScalingiOS")]
308    pub const ScalingiOS: Self = Self(1);
309}
310
311unsafe impl Encode for NSTextScalingType {
312    const ENCODING: Encoding = NSInteger::ENCODING;
313}
314
315unsafe impl RefEncode for NSTextScalingType {
316    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
317}
318
319/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsattributedstringdocumentattributekey?language=objc)
320// NS_TYPED_EXTENSIBLE_ENUM
321pub type NSAttributedStringDocumentAttributeKey = NSString;
322
323extern "C" {
324    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsdocumenttypedocumentattribute?language=objc)
325    pub static NSDocumentTypeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
326}
327
328extern "C" {
329    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscharacterencodingdocumentattribute?language=objc)
330    pub static NSCharacterEncodingDocumentAttribute:
331        &'static NSAttributedStringDocumentAttributeKey;
332}
333
334extern "C" {
335    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsdefaultattributesdocumentattribute?language=objc)
336    pub static NSDefaultAttributesDocumentAttribute:
337        &'static NSAttributedStringDocumentAttributeKey;
338}
339
340extern "C" {
341    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nspapersizedocumentattribute?language=objc)
342    pub static NSPaperSizeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
343}
344
345extern "C" {
346    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsviewsizedocumentattribute?language=objc)
347    pub static NSViewSizeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
348}
349
350extern "C" {
351    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsviewzoomdocumentattribute?language=objc)
352    pub static NSViewZoomDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
353}
354
355extern "C" {
356    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsviewmodedocumentattribute?language=objc)
357    pub static NSViewModeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
358}
359
360extern "C" {
361    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsdefaultfontexcludeddocumentattribute?language=objc)
362    pub static NSDefaultFontExcludedDocumentAttribute:
363        &'static NSAttributedStringDocumentAttributeKey;
364}
365
366extern "C" {
367    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsreadonlydocumentattribute?language=objc)
368    pub static NSReadOnlyDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
369}
370
371extern "C" {
372    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsbackgroundcolordocumentattribute?language=objc)
373    pub static NSBackgroundColorDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
374}
375
376extern "C" {
377    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nshyphenationfactordocumentattribute?language=objc)
378    pub static NSHyphenationFactorDocumentAttribute:
379        &'static NSAttributedStringDocumentAttributeKey;
380}
381
382extern "C" {
383    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsdefaulttabintervaldocumentattribute?language=objc)
384    pub static NSDefaultTabIntervalDocumentAttribute:
385        &'static NSAttributedStringDocumentAttributeKey;
386}
387
388extern "C" {
389    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstextlayoutsectionsattribute?language=objc)
390    pub static NSTextLayoutSectionsAttribute: &'static NSAttributedStringDocumentAttributeKey;
391}
392
393extern "C" {
394    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstextscalingdocumentattribute?language=objc)
395    pub static NSTextScalingDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
396}
397
398extern "C" {
399    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nssourcetextscalingdocumentattribute?language=objc)
400    pub static NSSourceTextScalingDocumentAttribute:
401        &'static NSAttributedStringDocumentAttributeKey;
402}
403
404extern "C" {
405    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscocoaversiondocumentattribute?language=objc)
406    pub static NSCocoaVersionDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
407}
408
409/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsattributedstringdocumentreadingoptionkey?language=objc)
410// NS_TYPED_EXTENSIBLE_ENUM
411pub type NSAttributedStringDocumentReadingOptionKey = NSString;
412
413extern "C" {
414    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsdocumenttypedocumentoption?language=objc)
415    pub static NSDocumentTypeDocumentOption: &'static NSAttributedStringDocumentReadingOptionKey;
416}
417
418extern "C" {
419    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsdefaultattributesdocumentoption?language=objc)
420    pub static NSDefaultAttributesDocumentOption:
421        &'static NSAttributedStringDocumentReadingOptionKey;
422}
423
424extern "C" {
425    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscharacterencodingdocumentoption?language=objc)
426    pub static NSCharacterEncodingDocumentOption:
427        &'static NSAttributedStringDocumentReadingOptionKey;
428}
429
430extern "C" {
431    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstargettextscalingdocumentoption?language=objc)
432    pub static NSTargetTextScalingDocumentOption:
433        &'static NSAttributedStringDocumentReadingOptionKey;
434}
435
436extern "C" {
437    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nssourcetextscalingdocumentoption?language=objc)
438    pub static NSSourceTextScalingDocumentOption:
439        &'static NSAttributedStringDocumentReadingOptionKey;
440}
441
442extern "C" {
443    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstextkit1listmarkerformatdocumentoption?language=objc)
444    pub static NSTextKit1ListMarkerFormatDocumentOption:
445        &'static NSAttributedStringDocumentReadingOptionKey;
446}
447
448mod private_NSAttributedStringDocumentFormats {
449    pub trait Sealed {}
450}
451
452/// Category on [`NSAttributedString`].
453pub unsafe trait NSAttributedStringDocumentFormats:
454    ClassType + Sized + private_NSAttributedStringDocumentFormats::Sealed
455{
456    extern_methods!(
457        /// # Safety
458        ///
459        /// - `options` generic should be of the correct type.
460        /// - `dict` generic should be of the correct type.
461        #[unsafe(method(initWithURL:options:documentAttributes:error:_))]
462        #[unsafe(method_family = init)]
463        unsafe fn initWithURL_options_documentAttributes_error(
464            this: Allocated<Self>,
465            url: &NSURL,
466            options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
467            dict: Option<
468                &mut Option<
469                    Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
470                >,
471            >,
472        ) -> Result<Retained<Self>, Retained<NSError>>;
473
474        /// # Safety
475        ///
476        /// - `options` generic should be of the correct type.
477        /// - `dict` generic should be of the correct type.
478        #[unsafe(method(initWithData:options:documentAttributes:error:_))]
479        #[unsafe(method_family = init)]
480        unsafe fn initWithData_options_documentAttributes_error(
481            this: Allocated<Self>,
482            data: &NSData,
483            options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
484            dict: Option<
485                &mut Option<
486                    Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
487                >,
488            >,
489        ) -> Result<Retained<Self>, Retained<NSError>>;
490
491        /// # Safety
492        ///
493        /// `dict` generic should be of the correct type.
494        #[unsafe(method(dataFromRange:documentAttributes:error:_))]
495        #[unsafe(method_family = none)]
496        unsafe fn dataFromRange_documentAttributes_error(
497            &self,
498            range: NSRange,
499            dict: &NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>,
500        ) -> Result<Retained<NSData>, Retained<NSError>>;
501
502        /// # Safety
503        ///
504        /// `dict` generic should be of the correct type.
505        #[unsafe(method(fileWrapperFromRange:documentAttributes:error:_))]
506        #[unsafe(method_family = none)]
507        unsafe fn fileWrapperFromRange_documentAttributes_error(
508            &self,
509            range: NSRange,
510            dict: &NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>,
511        ) -> Result<Retained<NSFileWrapper>, Retained<NSError>>;
512    );
513}
514
515impl private_NSAttributedStringDocumentFormats::Sealed for NSAttributedString {}
516unsafe impl NSAttributedStringDocumentFormats for NSAttributedString {}
517
518mod private_NSMutableAttributedStringDocumentFormats {
519    pub trait Sealed {}
520}
521
522/// Category on [`NSMutableAttributedString`].
523pub unsafe trait NSMutableAttributedStringDocumentFormats:
524    ClassType + Sized + private_NSMutableAttributedStringDocumentFormats::Sealed
525{
526    extern_methods!(
527        /// # Safety
528        ///
529        /// - `opts` generic should be of the correct type.
530        /// - `dict` generic should be of the correct type.
531        #[unsafe(method(readFromURL:options:documentAttributes:error:_))]
532        #[unsafe(method_family = none)]
533        unsafe fn readFromURL_options_documentAttributes_error(
534            &self,
535            url: &NSURL,
536            opts: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
537            dict: Option<
538                &mut Option<
539                    Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
540                >,
541            >,
542        ) -> Result<(), Retained<NSError>>;
543
544        /// # Safety
545        ///
546        /// - `opts` generic should be of the correct type.
547        /// - `dict` generic should be of the correct type.
548        #[unsafe(method(readFromData:options:documentAttributes:error:_))]
549        #[unsafe(method_family = none)]
550        unsafe fn readFromData_options_documentAttributes_error(
551            &self,
552            data: &NSData,
553            opts: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
554            dict: Option<
555                &mut Option<
556                    Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
557                >,
558            >,
559        ) -> Result<(), Retained<NSError>>;
560    );
561}
562
563impl private_NSMutableAttributedStringDocumentFormats::Sealed for NSMutableAttributedString {}
564unsafe impl NSMutableAttributedStringDocumentFormats for NSMutableAttributedString {}
565
566mod private_NSAttributedStringKitAdditions {
567    pub trait Sealed {}
568}
569
570/// Category on [`NSAttributedString`].
571///
572/// ********************** Misc methods ***********************
573pub unsafe trait NSAttributedStringKitAdditions:
574    ClassType + Sized + private_NSAttributedStringKitAdditions::Sealed
575{
576    extern_methods!(
577        #[unsafe(method(containsAttachmentsInRange:))]
578        #[unsafe(method_family = none)]
579        fn containsAttachmentsInRange(&self, range: NSRange) -> bool;
580
581        #[unsafe(method(prefersRTFDInRange:))]
582        #[unsafe(method_family = none)]
583        fn prefersRTFDInRange(&self, range: NSRange) -> bool;
584    );
585}
586
587impl private_NSAttributedStringKitAdditions::Sealed for NSAttributedString {}
588unsafe impl NSAttributedStringKitAdditions for NSAttributedString {}
589
590extern "C" {
591    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nspapermargindocumentattribute?language=objc)
592    pub static NSPaperMarginDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
593}
594
595extern "C" {
596    /// ********************** Deprecated ***********************
597    ///
598    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/nsobliquenessattributename?language=objc)
599    #[deprecated = "This attribute is not supported with TextKit 2"]
600    pub static NSObliquenessAttributeName: &'static NSAttributedStringKey;
601}
602
603extern "C" {
604    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsexpansionattributename?language=objc)
605    #[deprecated = "This attribute is not supported with TextKit 2"]
606    pub static NSExpansionAttributeName: &'static NSAttributedStringKey;
607}
608
609extern "C" {
610    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsverticalglyphformattributename?language=objc)
611    #[deprecated = "This attribute is not supported with TextKit 2"]
612    pub static NSVerticalGlyphFormAttributeName: &'static NSAttributedStringKey;
613}
614
615/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsunderlinepatternsolid?language=objc)
616#[deprecated]
617pub static NSUnderlinePatternSolid: NSUnderlineStyle =
618    NSUnderlineStyle(NSUnderlineStyle::PatternSolid.0);
619
620/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsunderlinepatterndot?language=objc)
621#[deprecated]
622pub static NSUnderlinePatternDot: NSUnderlineStyle =
623    NSUnderlineStyle(NSUnderlineStyle::PatternDot.0);
624
625/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsunderlinepatterndash?language=objc)
626#[deprecated]
627pub static NSUnderlinePatternDash: NSUnderlineStyle =
628    NSUnderlineStyle(NSUnderlineStyle::PatternDash.0);
629
630/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsunderlinepatterndashdot?language=objc)
631#[deprecated]
632pub static NSUnderlinePatternDashDot: NSUnderlineStyle =
633    NSUnderlineStyle(NSUnderlineStyle::PatternDashDot.0);
634
635/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsunderlinepatterndashdotdot?language=objc)
636#[deprecated]
637pub static NSUnderlinePatternDashDotDot: NSUnderlineStyle =
638    NSUnderlineStyle(NSUnderlineStyle::PatternDashDotDot.0);
639
640/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsunderlinebyword?language=objc)
641#[deprecated]
642pub static NSUnderlineByWord: NSUnderlineStyle = NSUnderlineStyle(NSUnderlineStyle::ByWord.0);
643
644/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstextwritingdirection?language=objc)
645// NS_ENUM
646#[deprecated]
647#[repr(transparent)]
648#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
649pub struct NSTextWritingDirection(pub NSInteger);
650impl NSTextWritingDirection {
651    #[doc(alias = "NSTextWritingDirectionEmbedding")]
652    #[deprecated]
653    pub const Embedding: Self = Self(0 << 1);
654    #[doc(alias = "NSTextWritingDirectionOverride")]
655    #[deprecated]
656    pub const Override: Self = Self(1 << 1);
657}
658
659unsafe impl Encode for NSTextWritingDirection {
660    const ENCODING: Encoding = NSInteger::ENCODING;
661}
662
663unsafe impl RefEncode for NSTextWritingDirection {
664    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
665}