objc2_web_kit/generated/WebResource.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
9extern_class!(
10 /// A WebResource represents a fully downloaded URL.
11 /// It includes the data of the resource as well as the metadata associated with the resource.
12 ///
13 /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webresource?language=objc)
14 #[unsafe(super(NSObject))]
15 #[derive(Debug, PartialEq, Eq, Hash)]
16 pub struct WebResource;
17);
18
19extern_conformance!(
20 unsafe impl NSCoding for WebResource {}
21);
22
23extern_conformance!(
24 unsafe impl NSCopying for WebResource {}
25);
26
27unsafe impl CopyingHelper for WebResource {
28 type Result = Self;
29}
30
31extern_conformance!(
32 unsafe impl NSObjectProtocol for WebResource {}
33);
34
35impl WebResource {
36 extern_methods!(
37 /// The initializer for WebResource.
38 ///
39 /// Parameter `data`: The data of the resource.
40 ///
41 /// Parameter `URL`: The URL of the resource.
42 ///
43 /// Parameter `MIMEType`: The MIME type of the resource.
44 ///
45 /// Parameter `textEncodingName`: The text encoding name of the resource (can be nil).
46 ///
47 /// Parameter `frameName`: The frame name of the resource if the resource represents the contents of an entire HTML frame (can be nil).
48 ///
49 /// Returns: An initialized WebResource.
50 ///
51 /// # Safety
52 ///
53 /// - `data` might not allow `None`.
54 /// - `url` might not allow `None`.
55 /// - `mime_type` might not allow `None`.
56 /// - `text_encoding_name` might not allow `None`.
57 /// - `frame_name` might not allow `None`.
58 #[unsafe(method(initWithData:URL:MIMEType:textEncodingName:frameName:))]
59 #[unsafe(method_family = init)]
60 pub unsafe fn initWithData_URL_MIMEType_textEncodingName_frameName(
61 this: Allocated<Self>,
62 data: Option<&NSData>,
63 url: Option<&NSURL>,
64 mime_type: Option<&NSString>,
65 text_encoding_name: Option<&NSString>,
66 frame_name: Option<&NSString>,
67 ) -> Option<Retained<Self>>;
68
69 /// The data of the resource.
70 #[unsafe(method(data))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn data(&self) -> Retained<NSData>;
73
74 /// The URL of the resource.
75 #[unsafe(method(URL))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
78
79 /// The MIME type of the resource.
80 #[unsafe(method(MIMEType))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn MIMEType(&self) -> Retained<NSString>;
83
84 /// The text encoding name of the resource (can be nil).
85 #[unsafe(method(textEncodingName))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn textEncodingName(&self) -> Retained<NSString>;
88
89 /// The frame name of the resource if the resource represents the contents of an entire HTML frame (can be nil).
90 #[unsafe(method(frameName))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn frameName(&self) -> Retained<NSString>;
93 );
94}
95
96/// Methods declared on superclass `NSObject`.
97impl WebResource {
98 extern_methods!(
99 #[unsafe(method(init))]
100 #[unsafe(method_family = init)]
101 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
102
103 #[unsafe(method(new))]
104 #[unsafe(method_family = new)]
105 pub unsafe fn new() -> Retained<Self>;
106 );
107}