objc2_web_kit/generated/
WKWebExtensionMatchPattern.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern "C" {
11 pub static WKWebExtensionMatchPatternErrorDomain: &'static NSErrorDomain;
15}
16
17#[repr(transparent)]
22#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
23pub struct WKWebExtensionMatchPatternError(pub NSInteger);
24impl WKWebExtensionMatchPatternError {
25 #[doc(alias = "WKWebExtensionMatchPatternErrorUnknown")]
26 pub const Unknown: Self = Self(1);
27 #[doc(alias = "WKWebExtensionMatchPatternErrorInvalidScheme")]
28 pub const InvalidScheme: Self = Self(2);
29 #[doc(alias = "WKWebExtensionMatchPatternErrorInvalidHost")]
30 pub const InvalidHost: Self = Self(3);
31 #[doc(alias = "WKWebExtensionMatchPatternErrorInvalidPath")]
32 pub const InvalidPath: Self = Self(4);
33}
34
35unsafe impl Encode for WKWebExtensionMatchPatternError {
36 const ENCODING: Encoding = NSInteger::ENCODING;
37}
38
39unsafe impl RefEncode for WKWebExtensionMatchPatternError {
40 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
41}
42
43#[repr(transparent)]
48#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
49pub struct WKWebExtensionMatchPatternOptions(pub NSUInteger);
50bitflags::bitflags! {
51 impl WKWebExtensionMatchPatternOptions: NSUInteger {
52 #[doc(alias = "WKWebExtensionMatchPatternOptionsNone")]
53 const None = 0;
54 #[doc(alias = "WKWebExtensionMatchPatternOptionsIgnoreSchemes")]
55 const IgnoreSchemes = 1<<0;
56 #[doc(alias = "WKWebExtensionMatchPatternOptionsIgnorePaths")]
57 const IgnorePaths = 1<<1;
58 #[doc(alias = "WKWebExtensionMatchPatternOptionsMatchBidirectionally")]
59 const MatchBidirectionally = 1<<2;
60 }
61}
62
63unsafe impl Encode for WKWebExtensionMatchPatternOptions {
64 const ENCODING: Encoding = NSUInteger::ENCODING;
65}
66
67unsafe impl RefEncode for WKWebExtensionMatchPatternOptions {
68 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
69}
70
71extern_class!(
72 #[unsafe(super(NSObject))]
81 #[thread_kind = MainThreadOnly]
82 #[derive(Debug, PartialEq, Eq, Hash)]
83 pub struct WKWebExtensionMatchPattern;
84);
85
86extern_conformance!(
87 unsafe impl NSCoding for WKWebExtensionMatchPattern {}
88);
89
90extern_conformance!(
91 unsafe impl NSCopying for WKWebExtensionMatchPattern {}
92);
93
94unsafe impl CopyingHelper for WKWebExtensionMatchPattern {
95 type Result = Self;
96}
97
98extern_conformance!(
99 unsafe impl NSObjectProtocol for WKWebExtensionMatchPattern {}
100);
101
102extern_conformance!(
103 unsafe impl NSSecureCoding for WKWebExtensionMatchPattern {}
104);
105
106impl WKWebExtensionMatchPattern {
107 extern_methods!(
108 #[unsafe(method(new))]
109 #[unsafe(method_family = new)]
110 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
111
112 #[unsafe(method(init))]
113 #[unsafe(method_family = init)]
114 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
115
116 #[unsafe(method(registerCustomURLScheme:))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn registerCustomURLScheme(url_scheme: &NSString, mtm: MainThreadMarker);
127
128 #[unsafe(method(allURLsMatchPattern))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn allURLsMatchPattern(mtm: MainThreadMarker) -> Retained<Self>;
134
135 #[unsafe(method(allHostsAndSchemesMatchPattern))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn allHostsAndSchemesMatchPattern(mtm: MainThreadMarker) -> Retained<Self>;
139
140 #[unsafe(method(matchPatternWithString:))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn matchPatternWithString(
148 string: &NSString,
149 mtm: MainThreadMarker,
150 ) -> Option<Retained<Self>>;
151
152 #[unsafe(method(matchPatternWithScheme:host:path:))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn matchPatternWithScheme_host_path(
160 scheme: &NSString,
161 host: &NSString,
162 path: &NSString,
163 mtm: MainThreadMarker,
164 ) -> Option<Retained<Self>>;
165
166 #[unsafe(method(initWithString:error:_))]
175 #[unsafe(method_family = init)]
176 pub unsafe fn initWithString_error(
177 this: Allocated<Self>,
178 string: &NSString,
179 ) -> Result<Retained<Self>, Retained<NSError>>;
180
181 #[unsafe(method(initWithScheme:host:path:error:_))]
190 #[unsafe(method_family = init)]
191 pub unsafe fn initWithScheme_host_path_error(
192 this: Allocated<Self>,
193 scheme: &NSString,
194 host: &NSString,
195 path: &NSString,
196 ) -> Result<Retained<Self>, Retained<NSError>>;
197
198 #[unsafe(method(string))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn string(&self) -> Retained<NSString>;
202
203 #[unsafe(method(scheme))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn scheme(&self) -> Option<Retained<NSString>>;
207
208 #[unsafe(method(host))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn host(&self) -> Option<Retained<NSString>>;
212
213 #[unsafe(method(path))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn path(&self) -> Option<Retained<NSString>>;
217
218 #[unsafe(method(matchesAllURLs))]
222 #[unsafe(method_family = none)]
223 pub unsafe fn matchesAllURLs(&self) -> bool;
224
225 #[unsafe(method(matchesAllHosts))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn matchesAllHosts(&self) -> bool;
231
232 #[unsafe(method(matchesURL:))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn matchesURL(&self, url: Option<&NSURL>) -> bool;
242
243 #[unsafe(method(matchesURL:options:))]
253 #[unsafe(method_family = none)]
254 pub unsafe fn matchesURL_options(
255 &self,
256 url: Option<&NSURL>,
257 options: WKWebExtensionMatchPatternOptions,
258 ) -> bool;
259
260 #[unsafe(method(matchesPattern:))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn matchesPattern(&self, pattern: Option<&WKWebExtensionMatchPattern>) -> bool;
270
271 #[unsafe(method(matchesPattern:options:))]
281 #[unsafe(method_family = none)]
282 pub unsafe fn matchesPattern_options(
283 &self,
284 pattern: Option<&WKWebExtensionMatchPattern>,
285 options: WKWebExtensionMatchPatternOptions,
286 ) -> bool;
287 );
288}