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
26unsafe impl NSCopying for NSDataAsset {}
27
28unsafe impl CopyingHelper for NSDataAsset {
29    type Result = Self;
30}
31
32unsafe impl NSObjectProtocol for NSDataAsset {}
33
34impl NSDataAsset {
35    extern_methods!(
36        #[unsafe(method(init))]
37        #[unsafe(method_family = init)]
38        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
39
40        /// Equivalent to -initWithName:name bundle:[NSBundle mainBundle];
41        #[unsafe(method(initWithName:))]
42        #[unsafe(method_family = init)]
43        pub unsafe fn initWithName(
44            this: Allocated<Self>,
45            name: &NSDataAssetName,
46        ) -> Option<Retained<Self>>;
47
48        /// Create a data asset with the given name from the given bundle. Returns nil if the asset was not found.
49        #[unsafe(method(initWithName:bundle:))]
50        #[unsafe(method_family = init)]
51        pub unsafe fn initWithName_bundle(
52            this: Allocated<Self>,
53            name: &NSDataAssetName,
54            bundle: &NSBundle,
55        ) -> Option<Retained<Self>>;
56
57        /// The name used to reference the data asset
58        #[unsafe(method(name))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn name(&self) -> Retained<NSDataAssetName>;
61
62        /// The data for this asset, as stored in the asset catalog
63        #[unsafe(method(data))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn data(&self) -> Retained<NSData>;
66
67        /// The Uniform Type Identifier for this data object.
68        #[unsafe(method(typeIdentifier))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn typeIdentifier(&self) -> Retained<NSString>;
71    );
72}
73
74/// Methods declared on superclass `NSObject`.
75impl NSDataAsset {
76    extern_methods!(
77        #[unsafe(method(new))]
78        #[unsafe(method_family = new)]
79        pub unsafe fn new() -> Retained<Self>;
80    );
81}