objc2_ui_kit/generated/
NSDataAsset.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nsdataassetname?language=objc)
10pub type NSDataAssetName = NSString;
11
12extern_class!(
13    /// NSDataAsset represents the contents of data entries in your asset catalog.
14    /// Data assets are not in the same class of stored content as images, so you cannot use a data asset to get image data for an image.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/nsdataasset?language=objc)
17    #[unsafe(super(NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct NSDataAsset;
20);
21
22unsafe impl Send for NSDataAsset {}
23
24unsafe impl Sync for NSDataAsset {}
25
26extern_conformance!(
27    unsafe impl NSCopying for NSDataAsset {}
28);
29
30unsafe impl CopyingHelper for NSDataAsset {
31    type Result = Self;
32}
33
34extern_conformance!(
35    unsafe impl NSObjectProtocol for NSDataAsset {}
36);
37
38impl NSDataAsset {
39    extern_methods!(
40        #[unsafe(method(init))]
41        #[unsafe(method_family = init)]
42        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
43
44        /// Equivalent to -initWithName:name bundle:[NSBundle mainBundle];
45        #[unsafe(method(initWithName:))]
46        #[unsafe(method_family = init)]
47        pub fn initWithName(
48            this: Allocated<Self>,
49            name: &NSDataAssetName,
50        ) -> Option<Retained<Self>>;
51
52        /// Create a data asset with the given name from the given bundle. Returns nil if the asset was not found.
53        #[unsafe(method(initWithName:bundle:))]
54        #[unsafe(method_family = init)]
55        pub fn initWithName_bundle(
56            this: Allocated<Self>,
57            name: &NSDataAssetName,
58            bundle: &NSBundle,
59        ) -> Option<Retained<Self>>;
60
61        /// The name used to reference the data asset
62        ///
63        /// This property is not atomic.
64        ///
65        /// # Safety
66        ///
67        /// This might not be thread-safe.
68        #[unsafe(method(name))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn name(&self) -> Retained<NSDataAssetName>;
71
72        /// The data for this asset, as stored in the asset catalog
73        ///
74        /// This property is not atomic.
75        ///
76        /// # Safety
77        ///
78        /// This might not be thread-safe.
79        #[unsafe(method(data))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn data(&self) -> Retained<NSData>;
82
83        /// The Uniform Type Identifier for this data object.
84        ///
85        /// This property is not atomic.
86        ///
87        /// # Safety
88        ///
89        /// This might not be thread-safe.
90        #[unsafe(method(typeIdentifier))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn typeIdentifier(&self) -> Retained<NSString>;
93    );
94}
95
96/// Methods declared on superclass `NSObject`.
97impl NSDataAsset {
98    extern_methods!(
99        #[unsafe(method(new))]
100        #[unsafe(method_family = new)]
101        pub unsafe fn new() -> Retained<Self>;
102    );
103}