1 | #![allow ( |
2 | non_snake_case, |
3 | non_upper_case_globals, |
4 | non_camel_case_types, |
5 | dead_code, |
6 | clippy::all |
7 | )] |
8 | |
9 | #[repr (transparent)] |
10 | #[derive (Clone, Debug, Eq, PartialEq)] |
11 | pub struct IIterable<T>(windows_core::IUnknown, core::marker::PhantomData<T>) |
12 | where |
13 | T: windows_core::RuntimeType + 'static; |
14 | impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IUnknown> |
15 | for IIterable<T> |
16 | { |
17 | } |
18 | impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IInspectable> |
19 | for IIterable<T> |
20 | { |
21 | } |
22 | unsafe impl<T: windows_core::RuntimeType + 'static> windows_core::Interface for IIterable<T> { |
23 | type Vtable = IIterable_Vtbl<T>; |
24 | const IID: windows_core::GUID = |
25 | windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE); |
26 | } |
27 | impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeType for IIterable<T> { |
28 | const SIGNATURE: windows_core::imp::ConstBuffer = windows_coreConstBuffer::imp::ConstBuffer::new() |
29 | .push_slice(b"pinterface({faa585ea-6214-4217-afda-7f46de5869b3}" ) |
30 | .push_slice(b";" ) |
31 | .push_other(T::SIGNATURE) |
32 | .push_slice(b")" ); |
33 | } |
34 | impl<T: windows_core::RuntimeType + 'static> IIterable<T> { |
35 | pub fn First(&self) -> windows_core::Result<IIterator<T>> { |
36 | let this: &IIterable = self; |
37 | unsafe { |
38 | let mut result__: *mut c_void = core::mem::zeroed(); |
39 | (windows_core::Interface::vtable(this).First)( |
40 | windows_core::Interface::as_raw(this), |
41 | &mut result__, |
42 | ) |
43 | .and_then(|| windows_core::Type::from_abi(result__)) |
44 | } |
45 | } |
46 | } |
47 | impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeName for IIterable<T> { |
48 | const NAME: &'static str = "Windows.Foundation.Collections.IIterable" ; |
49 | } |
50 | pub trait IIterable_Impl<T>: windows_core::IUnknownImpl |
51 | where |
52 | T: windows_core::RuntimeType + 'static, |
53 | { |
54 | fn First(&self) -> windows_core::Result<IIterator<T>>; |
55 | } |
56 | impl<T: windows_core::RuntimeType + 'static> IIterable_Vtbl<T> { |
57 | pub const fn new<Identity: IIterable_Impl<T>, const OFFSET: isize>() -> Self { |
58 | unsafe extern "system" fn First< |
59 | T: windows_core::RuntimeType + 'static, |
60 | Identity: IIterable_Impl<T>, |
61 | const OFFSET: isize, |
62 | >( |
63 | this: *mut core::ffi::c_void, |
64 | result__: *mut *mut core::ffi::c_void, |
65 | ) -> windows_core::HRESULT { |
66 | unsafe { |
67 | let this: &Identity = |
68 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
69 | match IIterable_Impl::First(this) { |
70 | Ok(ok__) => { |
71 | result__.write(core::mem::transmute_copy(&ok__)); |
72 | core::mem::forget(ok__); |
73 | windows_core::HRESULT(0) |
74 | } |
75 | Err(err) => err.into(), |
76 | } |
77 | } |
78 | } |
79 | Self { |
80 | base__: windows_core::IInspectable_Vtbl::new::<Identity, IIterable<T>, OFFSET>(), |
81 | First: First::<T, Identity, OFFSET>, |
82 | T: core::marker::PhantomData::<T>, |
83 | } |
84 | } |
85 | pub fn matches(iid: &windows_core::GUID) -> bool { |
86 | iid == &<IIterable<T> as windows_core::Interface>::IID |
87 | } |
88 | } |
89 | #[repr (C)] |
90 | #[doc (hidden)] |
91 | pub struct IIterable_Vtbl<T> |
92 | where |
93 | T: windows_core::RuntimeType + 'static, |
94 | { |
95 | pub base__: windows_core::IInspectable_Vtbl, |
96 | pub First: unsafe extern "system" fn( |
97 | *mut core::ffi::c_void, |
98 | *mut *mut core::ffi::c_void, |
99 | ) -> windows_core::HRESULT, |
100 | T: core::marker::PhantomData<T>, |
101 | } |
102 | impl<T: windows_core::RuntimeType> IntoIterator for IIterable<T> { |
103 | type Item = T; |
104 | type IntoIter = IIterator<Self::Item>; |
105 | fn into_iter(self) -> Self::IntoIter { |
106 | IntoIterator::into_iter(&self) |
107 | } |
108 | } |
109 | impl<T: windows_core::RuntimeType> IntoIterator for &IIterable<T> { |
110 | type Item = T; |
111 | type IntoIter = IIterator<Self::Item>; |
112 | fn into_iter(self) -> Self::IntoIter { |
113 | self.First().unwrap() |
114 | } |
115 | } |
116 | #[repr (transparent)] |
117 | #[derive (Clone, Debug, Eq, PartialEq)] |
118 | pub struct IIterator<T>(windows_core::IUnknown, core::marker::PhantomData<T>) |
119 | where |
120 | T: windows_core::RuntimeType + 'static; |
121 | impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IUnknown> |
122 | for IIterator<T> |
123 | { |
124 | } |
125 | impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IInspectable> |
126 | for IIterator<T> |
127 | { |
128 | } |
129 | unsafe impl<T: windows_core::RuntimeType + 'static> windows_core::Interface for IIterator<T> { |
130 | type Vtable = IIterator_Vtbl<T>; |
131 | const IID: windows_core::GUID = |
132 | windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE); |
133 | } |
134 | impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeType for IIterator<T> { |
135 | const SIGNATURE: windows_core::imp::ConstBuffer = windows_coreConstBuffer::imp::ConstBuffer::new() |
136 | .push_slice(b"pinterface({6a79e863-4300-459a-9966-cbb660963ee1}" ) |
137 | .push_slice(b";" ) |
138 | .push_other(T::SIGNATURE) |
139 | .push_slice(b")" ); |
140 | } |
141 | impl<T: windows_core::RuntimeType + 'static> IIterator<T> { |
142 | pub fn Current(&self) -> windows_core::Result<T> { |
143 | let this = self; |
144 | unsafe { |
145 | let mut result__ = core::mem::zeroed(); |
146 | (windows_core::Interface::vtable(this).Current)( |
147 | windows_core::Interface::as_raw(this), |
148 | &mut result__, |
149 | ) |
150 | .and_then(|| windows_core::Type::from_abi(result__)) |
151 | } |
152 | } |
153 | pub fn HasCurrent(&self) -> windows_core::Result<bool> { |
154 | let this = self; |
155 | unsafe { |
156 | let mut result__ = core::mem::zeroed(); |
157 | (windows_core::Interface::vtable(this).HasCurrent)( |
158 | windows_core::Interface::as_raw(this), |
159 | &mut result__, |
160 | ) |
161 | .map(|| result__) |
162 | } |
163 | } |
164 | pub fn MoveNext(&self) -> windows_core::Result<bool> { |
165 | let this = self; |
166 | unsafe { |
167 | let mut result__ = core::mem::zeroed(); |
168 | (windows_core::Interface::vtable(this).MoveNext)( |
169 | windows_core::Interface::as_raw(this), |
170 | &mut result__, |
171 | ) |
172 | .map(|| result__) |
173 | } |
174 | } |
175 | pub fn GetMany( |
176 | &self, |
177 | items: &mut [<T as windows_core::Type<T>>::Default], |
178 | ) -> windows_core::Result<u32> { |
179 | let this = self; |
180 | unsafe { |
181 | let mut result__ = core::mem::zeroed(); |
182 | (windows_core::Interface::vtable(this).GetMany)( |
183 | windows_core::Interface::as_raw(this), |
184 | items.len().try_into().unwrap(), |
185 | core::mem::transmute_copy(&items), |
186 | &mut result__, |
187 | ) |
188 | .map(|| result__) |
189 | } |
190 | } |
191 | } |
192 | impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeName for IIterator<T> { |
193 | const NAME: &'static str = "Windows.Foundation.Collections.IIterator" ; |
194 | } |
195 | pub trait IIterator_Impl<T>: windows_core::IUnknownImpl |
196 | where |
197 | T: windows_core::RuntimeType + 'static, |
198 | { |
199 | fn Current(&self) -> windows_core::Result<T>; |
200 | fn HasCurrent(&self) -> windows_core::Result<bool>; |
201 | fn MoveNext(&self) -> windows_core::Result<bool>; |
202 | fn GetMany( |
203 | &self, |
204 | items: &mut [<T as windows_core::Type<T>>::Default], |
205 | ) -> windows_core::Result<u32>; |
206 | } |
207 | impl<T: windows_core::RuntimeType + 'static> IIterator_Vtbl<T> { |
208 | pub const fn new<Identity: IIterator_Impl<T>, const OFFSET: isize>() -> Self { |
209 | unsafe extern "system" fn Current< |
210 | T: windows_core::RuntimeType + 'static, |
211 | Identity: IIterator_Impl<T>, |
212 | const OFFSET: isize, |
213 | >( |
214 | this: *mut core::ffi::c_void, |
215 | result__: *mut windows_core::AbiType<T>, |
216 | ) -> windows_core::HRESULT { |
217 | unsafe { |
218 | let this: &Identity = |
219 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
220 | match IIterator_Impl::Current(this) { |
221 | Ok(ok__) => { |
222 | result__.write(core::mem::transmute_copy(&ok__)); |
223 | core::mem::forget(ok__); |
224 | windows_core::HRESULT(0) |
225 | } |
226 | Err(err) => err.into(), |
227 | } |
228 | } |
229 | } |
230 | unsafe extern "system" fn HasCurrent< |
231 | T: windows_core::RuntimeType + 'static, |
232 | Identity: IIterator_Impl<T>, |
233 | const OFFSET: isize, |
234 | >( |
235 | this: *mut core::ffi::c_void, |
236 | result__: *mut bool, |
237 | ) -> windows_core::HRESULT { |
238 | unsafe { |
239 | let this: &Identity = |
240 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
241 | match IIterator_Impl::HasCurrent(this) { |
242 | Ok(ok__) => { |
243 | result__.write(core::mem::transmute_copy(&ok__)); |
244 | windows_core::HRESULT(0) |
245 | } |
246 | Err(err) => err.into(), |
247 | } |
248 | } |
249 | } |
250 | unsafe extern "system" fn MoveNext< |
251 | T: windows_core::RuntimeType + 'static, |
252 | Identity: IIterator_Impl<T>, |
253 | const OFFSET: isize, |
254 | >( |
255 | this: *mut core::ffi::c_void, |
256 | result__: *mut bool, |
257 | ) -> windows_core::HRESULT { |
258 | unsafe { |
259 | let this: &Identity = |
260 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
261 | match IIterator_Impl::MoveNext(this) { |
262 | Ok(ok__) => { |
263 | result__.write(core::mem::transmute_copy(&ok__)); |
264 | windows_core::HRESULT(0) |
265 | } |
266 | Err(err) => err.into(), |
267 | } |
268 | } |
269 | } |
270 | unsafe extern "system" fn GetMany< |
271 | T: windows_core::RuntimeType + 'static, |
272 | Identity: IIterator_Impl<T>, |
273 | const OFFSET: isize, |
274 | >( |
275 | this: *mut core::ffi::c_void, |
276 | items_array_size: u32, |
277 | items: *mut T, |
278 | result__: *mut u32, |
279 | ) -> windows_core::HRESULT { |
280 | unsafe { |
281 | let this: &Identity = |
282 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
283 | match IIterator_Impl::GetMany( |
284 | this, |
285 | core::slice::from_raw_parts_mut( |
286 | core::mem::transmute_copy(&items), |
287 | items_array_size as usize, |
288 | ), |
289 | ) { |
290 | Ok(ok__) => { |
291 | result__.write(core::mem::transmute_copy(&ok__)); |
292 | windows_core::HRESULT(0) |
293 | } |
294 | Err(err) => err.into(), |
295 | } |
296 | } |
297 | } |
298 | Self { |
299 | base__: windows_core::IInspectable_Vtbl::new::<Identity, IIterator<T>, OFFSET>(), |
300 | Current: Current::<T, Identity, OFFSET>, |
301 | HasCurrent: HasCurrent::<T, Identity, OFFSET>, |
302 | MoveNext: MoveNext::<T, Identity, OFFSET>, |
303 | GetMany: GetMany::<T, Identity, OFFSET>, |
304 | T: core::marker::PhantomData::<T>, |
305 | } |
306 | } |
307 | pub fn matches(iid: &windows_core::GUID) -> bool { |
308 | iid == &<IIterator<T> as windows_core::Interface>::IID |
309 | } |
310 | } |
311 | #[repr (C)] |
312 | #[doc (hidden)] |
313 | pub struct IIterator_Vtbl<T> |
314 | where |
315 | T: windows_core::RuntimeType + 'static, |
316 | { |
317 | pub base__: windows_core::IInspectable_Vtbl, |
318 | pub Current: unsafe extern "system" fn( |
319 | *mut core::ffi::c_void, |
320 | *mut windows_core::AbiType<T>, |
321 | ) -> windows_core::HRESULT, |
322 | pub HasCurrent: |
323 | unsafe extern "system" fn(*mut core::ffi::c_void, *mut bool) -> windows_core::HRESULT, |
324 | pub MoveNext: |
325 | unsafe extern "system" fn(*mut core::ffi::c_void, *mut bool) -> windows_core::HRESULT, |
326 | pub GetMany: unsafe extern "system" fn( |
327 | *mut core::ffi::c_void, |
328 | u32, |
329 | *mut T, |
330 | *mut u32, |
331 | ) -> windows_core::HRESULT, |
332 | T: core::marker::PhantomData<T>, |
333 | } |
334 | impl<T: windows_core::RuntimeType> Iterator for IIterator<T> { |
335 | type Item = T; |
336 | fn next(&mut self) -> Option<Self::Item> { |
337 | let result: Option = if self.HasCurrent().unwrap_or(default:false) { |
338 | self.Current().ok() |
339 | } else { |
340 | None |
341 | }; |
342 | if result.is_some() { |
343 | self.MoveNext().ok()?; |
344 | } |
345 | result |
346 | } |
347 | } |
348 | #[repr (transparent)] |
349 | #[derive (Clone, Debug, Eq, PartialEq)] |
350 | pub struct IKeyValuePair<K, V>( |
351 | windows_core::IUnknown, |
352 | core::marker::PhantomData<K>, |
353 | core::marker::PhantomData<V>, |
354 | ) |
355 | where |
356 | K: windows_core::RuntimeType + 'static, |
357 | V: windows_core::RuntimeType + 'static; |
358 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
359 | windows_core::imp::CanInto<windows_core::IUnknown> for IKeyValuePair<K, V> |
360 | { |
361 | } |
362 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
363 | windows_core::imp::CanInto<windows_core::IInspectable> for IKeyValuePair<K, V> |
364 | { |
365 | } |
366 | unsafe impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
367 | windows_core::Interface for IKeyValuePair<K, V> |
368 | { |
369 | type Vtable = IKeyValuePair_Vtbl<K, V>; |
370 | const IID: windows_core::GUID = |
371 | windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE); |
372 | } |
373 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
374 | windows_core::RuntimeType for IKeyValuePair<K, V> |
375 | { |
376 | const SIGNATURE: windows_core::imp::ConstBuffer = windows_coreConstBuffer::imp::ConstBuffer::new() |
377 | .push_slice(b"pinterface({02b51929-c1c4-4a7e-8940-0312b5c18500}" ) |
378 | .push_slice(b";" ) |
379 | .push_other(K::SIGNATURE) |
380 | .push_slice(b";" ) |
381 | .push_other(V::SIGNATURE) |
382 | .push_slice(b")" ); |
383 | } |
384 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
385 | IKeyValuePair<K, V> |
386 | { |
387 | pub fn Key(&self) -> windows_core::Result<K> { |
388 | let this: &IKeyValuePair = self; |
389 | unsafe { |
390 | let mut result__: ::TypeKind>>::Abi = core::mem::zeroed(); |
391 | (windows_core::Interface::vtable(this).Key)( |
392 | windows_core::Interface::as_raw(this), |
393 | &mut result__, |
394 | ) |
395 | .and_then(|| windows_core::Type::from_abi(result__)) |
396 | } |
397 | } |
398 | pub fn Value(&self) -> windows_core::Result<V> { |
399 | let this: &IKeyValuePair = self; |
400 | unsafe { |
401 | let mut result__: ::TypeKind>>::Abi = core::mem::zeroed(); |
402 | (windows_core::Interface::vtable(this).Value)( |
403 | windows_core::Interface::as_raw(this), |
404 | &mut result__, |
405 | ) |
406 | .and_then(|| windows_core::Type::from_abi(result__)) |
407 | } |
408 | } |
409 | } |
410 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
411 | windows_core::RuntimeName for IKeyValuePair<K, V> |
412 | { |
413 | const NAME: &'static str = "Windows.Foundation.Collections.IKeyValuePair" ; |
414 | } |
415 | pub trait IKeyValuePair_Impl<K, V>: windows_core::IUnknownImpl |
416 | where |
417 | K: windows_core::RuntimeType + 'static, |
418 | V: windows_core::RuntimeType + 'static, |
419 | { |
420 | fn Key(&self) -> windows_core::Result<K>; |
421 | fn Value(&self) -> windows_core::Result<V>; |
422 | } |
423 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
424 | IKeyValuePair_Vtbl<K, V> |
425 | { |
426 | pub const fn new<Identity: IKeyValuePair_Impl<K, V>, const OFFSET: isize>() -> Self { |
427 | unsafe extern "system" fn Key< |
428 | K: windows_core::RuntimeType + 'static, |
429 | V: windows_core::RuntimeType + 'static, |
430 | Identity: IKeyValuePair_Impl<K, V>, |
431 | const OFFSET: isize, |
432 | >( |
433 | this: *mut core::ffi::c_void, |
434 | result__: *mut windows_core::AbiType<K>, |
435 | ) -> windows_core::HRESULT { |
436 | unsafe { |
437 | let this: &Identity = |
438 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
439 | match IKeyValuePair_Impl::Key(this) { |
440 | Ok(ok__) => { |
441 | result__.write(core::mem::transmute_copy(&ok__)); |
442 | core::mem::forget(ok__); |
443 | windows_core::HRESULT(0) |
444 | } |
445 | Err(err) => err.into(), |
446 | } |
447 | } |
448 | } |
449 | unsafe extern "system" fn Value< |
450 | K: windows_core::RuntimeType + 'static, |
451 | V: windows_core::RuntimeType + 'static, |
452 | Identity: IKeyValuePair_Impl<K, V>, |
453 | const OFFSET: isize, |
454 | >( |
455 | this: *mut core::ffi::c_void, |
456 | result__: *mut windows_core::AbiType<V>, |
457 | ) -> windows_core::HRESULT { |
458 | unsafe { |
459 | let this: &Identity = |
460 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
461 | match IKeyValuePair_Impl::Value(this) { |
462 | Ok(ok__) => { |
463 | result__.write(core::mem::transmute_copy(&ok__)); |
464 | core::mem::forget(ok__); |
465 | windows_core::HRESULT(0) |
466 | } |
467 | Err(err) => err.into(), |
468 | } |
469 | } |
470 | } |
471 | Self { |
472 | base__: windows_core::IInspectable_Vtbl::new::<Identity, IKeyValuePair<K, V>, OFFSET>(), |
473 | Key: Key::<K, V, Identity, OFFSET>, |
474 | Value: Value::<K, V, Identity, OFFSET>, |
475 | K: core::marker::PhantomData::<K>, |
476 | V: core::marker::PhantomData::<V>, |
477 | } |
478 | } |
479 | pub fn matches(iid: &windows_core::GUID) -> bool { |
480 | iid == &<IKeyValuePair<K, V> as windows_core::Interface>::IID |
481 | } |
482 | } |
483 | #[repr (C)] |
484 | #[doc (hidden)] |
485 | pub struct IKeyValuePair_Vtbl<K, V> |
486 | where |
487 | K: windows_core::RuntimeType + 'static, |
488 | V: windows_core::RuntimeType + 'static, |
489 | { |
490 | pub base__: windows_core::IInspectable_Vtbl, |
491 | pub Key: unsafe extern "system" fn( |
492 | *mut core::ffi::c_void, |
493 | *mut windows_core::AbiType<K>, |
494 | ) -> windows_core::HRESULT, |
495 | pub Value: unsafe extern "system" fn( |
496 | *mut core::ffi::c_void, |
497 | *mut windows_core::AbiType<V>, |
498 | ) -> windows_core::HRESULT, |
499 | K: core::marker::PhantomData<K>, |
500 | V: core::marker::PhantomData<V>, |
501 | } |
502 | #[repr (transparent)] |
503 | #[derive (Clone, Debug, Eq, PartialEq)] |
504 | pub struct IMap<K, V>( |
505 | windows_core::IUnknown, |
506 | core::marker::PhantomData<K>, |
507 | core::marker::PhantomData<V>, |
508 | ) |
509 | where |
510 | K: windows_core::RuntimeType + 'static, |
511 | V: windows_core::RuntimeType + 'static; |
512 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
513 | windows_core::imp::CanInto<windows_core::IUnknown> for IMap<K, V> |
514 | { |
515 | } |
516 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
517 | windows_core::imp::CanInto<windows_core::IInspectable> for IMap<K, V> |
518 | { |
519 | } |
520 | unsafe impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
521 | windows_core::Interface for IMap<K, V> |
522 | { |
523 | type Vtable = IMap_Vtbl<K, V>; |
524 | const IID: windows_core::GUID = |
525 | windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE); |
526 | } |
527 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
528 | windows_core::RuntimeType for IMap<K, V> |
529 | { |
530 | const SIGNATURE: windows_core::imp::ConstBuffer = windows_coreConstBuffer::imp::ConstBuffer::new() |
531 | .push_slice(b"pinterface({3c2925fe-8519-45c1-aa79-197b6718c1c1}" ) |
532 | .push_slice(b";" ) |
533 | .push_other(K::SIGNATURE) |
534 | .push_slice(b";" ) |
535 | .push_other(V::SIGNATURE) |
536 | .push_slice(b")" ); |
537 | } |
538 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
539 | windows_core::imp::CanInto<IIterable<IKeyValuePair<K, V>>> for IMap<K, V> |
540 | { |
541 | const QUERY: bool = true; |
542 | } |
543 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> IMap<K, V> { |
544 | pub fn Lookup<P0>(&self, key: P0) -> windows_core::Result<V> |
545 | where |
546 | P0: windows_core::Param<K>, |
547 | { |
548 | let this = self; |
549 | unsafe { |
550 | let mut result__ = core::mem::zeroed(); |
551 | (windows_core::Interface::vtable(this).Lookup)( |
552 | windows_core::Interface::as_raw(this), |
553 | key.param().abi(), |
554 | &mut result__, |
555 | ) |
556 | .and_then(|| windows_core::Type::from_abi(result__)) |
557 | } |
558 | } |
559 | pub fn Size(&self) -> windows_core::Result<u32> { |
560 | let this = self; |
561 | unsafe { |
562 | let mut result__ = core::mem::zeroed(); |
563 | (windows_core::Interface::vtable(this).Size)( |
564 | windows_core::Interface::as_raw(this), |
565 | &mut result__, |
566 | ) |
567 | .map(|| result__) |
568 | } |
569 | } |
570 | pub fn HasKey<P0>(&self, key: P0) -> windows_core::Result<bool> |
571 | where |
572 | P0: windows_core::Param<K>, |
573 | { |
574 | let this = self; |
575 | unsafe { |
576 | let mut result__ = core::mem::zeroed(); |
577 | (windows_core::Interface::vtable(this).HasKey)( |
578 | windows_core::Interface::as_raw(this), |
579 | key.param().abi(), |
580 | &mut result__, |
581 | ) |
582 | .map(|| result__) |
583 | } |
584 | } |
585 | pub fn GetView(&self) -> windows_core::Result<IMapView<K, V>> { |
586 | let this = self; |
587 | unsafe { |
588 | let mut result__ = core::mem::zeroed(); |
589 | (windows_core::Interface::vtable(this).GetView)( |
590 | windows_core::Interface::as_raw(this), |
591 | &mut result__, |
592 | ) |
593 | .and_then(|| windows_core::Type::from_abi(result__)) |
594 | } |
595 | } |
596 | pub fn Insert<P0, P1>(&self, key: P0, value: P1) -> windows_core::Result<bool> |
597 | where |
598 | P0: windows_core::Param<K>, |
599 | P1: windows_core::Param<V>, |
600 | { |
601 | let this = self; |
602 | unsafe { |
603 | let mut result__ = core::mem::zeroed(); |
604 | (windows_core::Interface::vtable(this).Insert)( |
605 | windows_core::Interface::as_raw(this), |
606 | key.param().abi(), |
607 | value.param().abi(), |
608 | &mut result__, |
609 | ) |
610 | .map(|| result__) |
611 | } |
612 | } |
613 | pub fn Remove<P0>(&self, key: P0) -> windows_core::Result<()> |
614 | where |
615 | P0: windows_core::Param<K>, |
616 | { |
617 | let this = self; |
618 | unsafe { |
619 | (windows_core::Interface::vtable(this).Remove)( |
620 | windows_core::Interface::as_raw(this), |
621 | key.param().abi(), |
622 | ) |
623 | .ok() |
624 | } |
625 | } |
626 | pub fn Clear(&self) -> windows_core::Result<()> { |
627 | let this = self; |
628 | unsafe { |
629 | (windows_core::Interface::vtable(this).Clear)(windows_core::Interface::as_raw(this)) |
630 | .ok() |
631 | } |
632 | } |
633 | pub fn First(&self) -> windows_core::Result<IIterator<IKeyValuePair<K, V>>> { |
634 | let this = &windows_core::Interface::cast::<IIterable<IKeyValuePair<K, V>>>(self)?; |
635 | unsafe { |
636 | let mut result__ = core::mem::zeroed(); |
637 | (windows_core::Interface::vtable(this).First)( |
638 | windows_core::Interface::as_raw(this), |
639 | &mut result__, |
640 | ) |
641 | .and_then(|| windows_core::Type::from_abi(result__)) |
642 | } |
643 | } |
644 | } |
645 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> IntoIterator |
646 | for IMap<K, V> |
647 | { |
648 | type Item = IKeyValuePair<K, V>; |
649 | type IntoIter = IIterator<Self::Item>; |
650 | fn into_iter(self) -> Self::IntoIter { |
651 | IntoIterator::into_iter(&self) |
652 | } |
653 | } |
654 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> IntoIterator |
655 | for &IMap<K, V> |
656 | { |
657 | type Item = IKeyValuePair<K, V>; |
658 | type IntoIter = IIterator<Self::Item>; |
659 | fn into_iter(self) -> Self::IntoIter { |
660 | self.First().unwrap() |
661 | } |
662 | } |
663 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
664 | windows_core::RuntimeName for IMap<K, V> |
665 | { |
666 | const NAME: &'static str = "Windows.Foundation.Collections.IMap" ; |
667 | } |
668 | pub trait IMap_Impl<K, V>: IIterable_Impl<IKeyValuePair<K, V>> |
669 | where |
670 | K: windows_core::RuntimeType + 'static, |
671 | V: windows_core::RuntimeType + 'static, |
672 | { |
673 | fn Lookup(&self, key: windows_core::Ref<'_, K>) -> windows_core::Result<V>; |
674 | fn Size(&self) -> windows_core::Result<u32>; |
675 | fn HasKey(&self, key: windows_core::Ref<'_, K>) -> windows_core::Result<bool>; |
676 | fn GetView(&self) -> windows_core::Result<IMapView<K, V>>; |
677 | fn Insert( |
678 | &self, |
679 | key: windows_core::Ref<'_, K>, |
680 | value: windows_core::Ref<'_, V>, |
681 | ) -> windows_core::Result<bool>; |
682 | fn Remove(&self, key: windows_core::Ref<'_, K>) -> windows_core::Result<()>; |
683 | fn Clear(&self) -> windows_core::Result<()>; |
684 | } |
685 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
686 | IMap_Vtbl<K, V> |
687 | { |
688 | pub const fn new<Identity: IMap_Impl<K, V>, const OFFSET: isize>() -> Self { |
689 | unsafe extern "system" fn Lookup< |
690 | K: windows_core::RuntimeType + 'static, |
691 | V: windows_core::RuntimeType + 'static, |
692 | Identity: IMap_Impl<K, V>, |
693 | const OFFSET: isize, |
694 | >( |
695 | this: *mut core::ffi::c_void, |
696 | key: windows_core::AbiType<K>, |
697 | result__: *mut windows_core::AbiType<V>, |
698 | ) -> windows_core::HRESULT { |
699 | unsafe { |
700 | let this: &Identity = |
701 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
702 | match IMap_Impl::Lookup(this, core::mem::transmute_copy(&key)) { |
703 | Ok(ok__) => { |
704 | result__.write(core::mem::transmute_copy(&ok__)); |
705 | core::mem::forget(ok__); |
706 | windows_core::HRESULT(0) |
707 | } |
708 | Err(err) => err.into(), |
709 | } |
710 | } |
711 | } |
712 | unsafe extern "system" fn Size< |
713 | K: windows_core::RuntimeType + 'static, |
714 | V: windows_core::RuntimeType + 'static, |
715 | Identity: IMap_Impl<K, V>, |
716 | const OFFSET: isize, |
717 | >( |
718 | this: *mut core::ffi::c_void, |
719 | result__: *mut u32, |
720 | ) -> windows_core::HRESULT { |
721 | unsafe { |
722 | let this: &Identity = |
723 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
724 | match IMap_Impl::Size(this) { |
725 | Ok(ok__) => { |
726 | result__.write(core::mem::transmute_copy(&ok__)); |
727 | windows_core::HRESULT(0) |
728 | } |
729 | Err(err) => err.into(), |
730 | } |
731 | } |
732 | } |
733 | unsafe extern "system" fn HasKey< |
734 | K: windows_core::RuntimeType + 'static, |
735 | V: windows_core::RuntimeType + 'static, |
736 | Identity: IMap_Impl<K, V>, |
737 | const OFFSET: isize, |
738 | >( |
739 | this: *mut core::ffi::c_void, |
740 | key: windows_core::AbiType<K>, |
741 | result__: *mut bool, |
742 | ) -> windows_core::HRESULT { |
743 | unsafe { |
744 | let this: &Identity = |
745 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
746 | match IMap_Impl::HasKey(this, core::mem::transmute_copy(&key)) { |
747 | Ok(ok__) => { |
748 | result__.write(core::mem::transmute_copy(&ok__)); |
749 | windows_core::HRESULT(0) |
750 | } |
751 | Err(err) => err.into(), |
752 | } |
753 | } |
754 | } |
755 | unsafe extern "system" fn GetView< |
756 | K: windows_core::RuntimeType + 'static, |
757 | V: windows_core::RuntimeType + 'static, |
758 | Identity: IMap_Impl<K, V>, |
759 | const OFFSET: isize, |
760 | >( |
761 | this: *mut core::ffi::c_void, |
762 | result__: *mut *mut core::ffi::c_void, |
763 | ) -> windows_core::HRESULT { |
764 | unsafe { |
765 | let this: &Identity = |
766 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
767 | match IMap_Impl::GetView(this) { |
768 | Ok(ok__) => { |
769 | result__.write(core::mem::transmute_copy(&ok__)); |
770 | core::mem::forget(ok__); |
771 | windows_core::HRESULT(0) |
772 | } |
773 | Err(err) => err.into(), |
774 | } |
775 | } |
776 | } |
777 | unsafe extern "system" fn Insert< |
778 | K: windows_core::RuntimeType + 'static, |
779 | V: windows_core::RuntimeType + 'static, |
780 | Identity: IMap_Impl<K, V>, |
781 | const OFFSET: isize, |
782 | >( |
783 | this: *mut core::ffi::c_void, |
784 | key: windows_core::AbiType<K>, |
785 | value: windows_core::AbiType<V>, |
786 | result__: *mut bool, |
787 | ) -> windows_core::HRESULT { |
788 | unsafe { |
789 | let this: &Identity = |
790 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
791 | match IMap_Impl::Insert( |
792 | this, |
793 | core::mem::transmute_copy(&key), |
794 | core::mem::transmute_copy(&value), |
795 | ) { |
796 | Ok(ok__) => { |
797 | result__.write(core::mem::transmute_copy(&ok__)); |
798 | windows_core::HRESULT(0) |
799 | } |
800 | Err(err) => err.into(), |
801 | } |
802 | } |
803 | } |
804 | unsafe extern "system" fn Remove< |
805 | K: windows_core::RuntimeType + 'static, |
806 | V: windows_core::RuntimeType + 'static, |
807 | Identity: IMap_Impl<K, V>, |
808 | const OFFSET: isize, |
809 | >( |
810 | this: *mut core::ffi::c_void, |
811 | key: windows_core::AbiType<K>, |
812 | ) -> windows_core::HRESULT { |
813 | unsafe { |
814 | let this: &Identity = |
815 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
816 | IMap_Impl::Remove(this, core::mem::transmute_copy(&key)).into() |
817 | } |
818 | } |
819 | unsafe extern "system" fn Clear< |
820 | K: windows_core::RuntimeType + 'static, |
821 | V: windows_core::RuntimeType + 'static, |
822 | Identity: IMap_Impl<K, V>, |
823 | const OFFSET: isize, |
824 | >( |
825 | this: *mut core::ffi::c_void, |
826 | ) -> windows_core::HRESULT { |
827 | unsafe { |
828 | let this: &Identity = |
829 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
830 | IMap_Impl::Clear(this).into() |
831 | } |
832 | } |
833 | Self { |
834 | base__: windows_core::IInspectable_Vtbl::new::<Identity, IMap<K, V>, OFFSET>(), |
835 | Lookup: Lookup::<K, V, Identity, OFFSET>, |
836 | Size: Size::<K, V, Identity, OFFSET>, |
837 | HasKey: HasKey::<K, V, Identity, OFFSET>, |
838 | GetView: GetView::<K, V, Identity, OFFSET>, |
839 | Insert: Insert::<K, V, Identity, OFFSET>, |
840 | Remove: Remove::<K, V, Identity, OFFSET>, |
841 | Clear: Clear::<K, V, Identity, OFFSET>, |
842 | K: core::marker::PhantomData::<K>, |
843 | V: core::marker::PhantomData::<V>, |
844 | } |
845 | } |
846 | pub fn matches(iid: &windows_core::GUID) -> bool { |
847 | iid == &<IMap<K, V> as windows_core::Interface>::IID |
848 | } |
849 | } |
850 | #[repr (C)] |
851 | #[doc (hidden)] |
852 | pub struct IMap_Vtbl<K, V> |
853 | where |
854 | K: windows_core::RuntimeType + 'static, |
855 | V: windows_core::RuntimeType + 'static, |
856 | { |
857 | pub base__: windows_core::IInspectable_Vtbl, |
858 | pub Lookup: unsafe extern "system" fn( |
859 | *mut core::ffi::c_void, |
860 | windows_core::AbiType<K>, |
861 | *mut windows_core::AbiType<V>, |
862 | ) -> windows_core::HRESULT, |
863 | pub Size: unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> windows_core::HRESULT, |
864 | pub HasKey: unsafe extern "system" fn( |
865 | *mut core::ffi::c_void, |
866 | windows_core::AbiType<K>, |
867 | *mut bool, |
868 | ) -> windows_core::HRESULT, |
869 | pub GetView: unsafe extern "system" fn( |
870 | *mut core::ffi::c_void, |
871 | *mut *mut core::ffi::c_void, |
872 | ) -> windows_core::HRESULT, |
873 | pub Insert: unsafe extern "system" fn( |
874 | *mut core::ffi::c_void, |
875 | windows_core::AbiType<K>, |
876 | windows_core::AbiType<V>, |
877 | *mut bool, |
878 | ) -> windows_core::HRESULT, |
879 | pub Remove: unsafe extern "system" fn( |
880 | *mut core::ffi::c_void, |
881 | windows_core::AbiType<K>, |
882 | ) -> windows_core::HRESULT, |
883 | pub Clear: unsafe extern "system" fn(*mut core::ffi::c_void) -> windows_core::HRESULT, |
884 | K: core::marker::PhantomData<K>, |
885 | V: core::marker::PhantomData<V>, |
886 | } |
887 | #[repr (transparent)] |
888 | #[derive (Clone, Debug, Eq, PartialEq)] |
889 | pub struct IMapView<K, V>( |
890 | windows_core::IUnknown, |
891 | core::marker::PhantomData<K>, |
892 | core::marker::PhantomData<V>, |
893 | ) |
894 | where |
895 | K: windows_core::RuntimeType + 'static, |
896 | V: windows_core::RuntimeType + 'static; |
897 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
898 | windows_core::imp::CanInto<windows_core::IUnknown> for IMapView<K, V> |
899 | { |
900 | } |
901 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
902 | windows_core::imp::CanInto<windows_core::IInspectable> for IMapView<K, V> |
903 | { |
904 | } |
905 | unsafe impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
906 | windows_core::Interface for IMapView<K, V> |
907 | { |
908 | type Vtable = IMapView_Vtbl<K, V>; |
909 | const IID: windows_core::GUID = |
910 | windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE); |
911 | } |
912 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
913 | windows_core::RuntimeType for IMapView<K, V> |
914 | { |
915 | const SIGNATURE: windows_core::imp::ConstBuffer = windows_coreConstBuffer::imp::ConstBuffer::new() |
916 | .push_slice(b"pinterface({e480ce40-a338-4ada-adcf-272272e48cb9}" ) |
917 | .push_slice(b";" ) |
918 | .push_other(K::SIGNATURE) |
919 | .push_slice(b";" ) |
920 | .push_other(V::SIGNATURE) |
921 | .push_slice(b")" ); |
922 | } |
923 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
924 | windows_core::imp::CanInto<IIterable<IKeyValuePair<K, V>>> for IMapView<K, V> |
925 | { |
926 | const QUERY: bool = true; |
927 | } |
928 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
929 | IMapView<K, V> |
930 | { |
931 | pub fn Lookup<P0>(&self, key: P0) -> windows_core::Result<V> |
932 | where |
933 | P0: windows_core::Param<K>, |
934 | { |
935 | let this = self; |
936 | unsafe { |
937 | let mut result__ = core::mem::zeroed(); |
938 | (windows_core::Interface::vtable(this).Lookup)( |
939 | windows_core::Interface::as_raw(this), |
940 | key.param().abi(), |
941 | &mut result__, |
942 | ) |
943 | .and_then(|| windows_core::Type::from_abi(result__)) |
944 | } |
945 | } |
946 | pub fn Size(&self) -> windows_core::Result<u32> { |
947 | let this = self; |
948 | unsafe { |
949 | let mut result__ = core::mem::zeroed(); |
950 | (windows_core::Interface::vtable(this).Size)( |
951 | windows_core::Interface::as_raw(this), |
952 | &mut result__, |
953 | ) |
954 | .map(|| result__) |
955 | } |
956 | } |
957 | pub fn HasKey<P0>(&self, key: P0) -> windows_core::Result<bool> |
958 | where |
959 | P0: windows_core::Param<K>, |
960 | { |
961 | let this = self; |
962 | unsafe { |
963 | let mut result__ = core::mem::zeroed(); |
964 | (windows_core::Interface::vtable(this).HasKey)( |
965 | windows_core::Interface::as_raw(this), |
966 | key.param().abi(), |
967 | &mut result__, |
968 | ) |
969 | .map(|| result__) |
970 | } |
971 | } |
972 | pub fn Split( |
973 | &self, |
974 | first: &mut Option<IMapView<K, V>>, |
975 | second: &mut Option<IMapView<K, V>>, |
976 | ) -> windows_core::Result<()> { |
977 | let this = self; |
978 | unsafe { |
979 | (windows_core::Interface::vtable(this).Split)( |
980 | windows_core::Interface::as_raw(this), |
981 | first as *mut _ as _, |
982 | second as *mut _ as _, |
983 | ) |
984 | .ok() |
985 | } |
986 | } |
987 | pub fn First(&self) -> windows_core::Result<IIterator<IKeyValuePair<K, V>>> { |
988 | let this = &windows_core::Interface::cast::<IIterable<IKeyValuePair<K, V>>>(self)?; |
989 | unsafe { |
990 | let mut result__ = core::mem::zeroed(); |
991 | (windows_core::Interface::vtable(this).First)( |
992 | windows_core::Interface::as_raw(this), |
993 | &mut result__, |
994 | ) |
995 | .and_then(|| windows_core::Type::from_abi(result__)) |
996 | } |
997 | } |
998 | } |
999 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> IntoIterator |
1000 | for IMapView<K, V> |
1001 | { |
1002 | type Item = IKeyValuePair<K, V>; |
1003 | type IntoIter = IIterator<Self::Item>; |
1004 | fn into_iter(self) -> Self::IntoIter { |
1005 | IntoIterator::into_iter(&self) |
1006 | } |
1007 | } |
1008 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> IntoIterator |
1009 | for &IMapView<K, V> |
1010 | { |
1011 | type Item = IKeyValuePair<K, V>; |
1012 | type IntoIter = IIterator<Self::Item>; |
1013 | fn into_iter(self) -> Self::IntoIter { |
1014 | self.First().unwrap() |
1015 | } |
1016 | } |
1017 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
1018 | windows_core::RuntimeName for IMapView<K, V> |
1019 | { |
1020 | const NAME: &'static str = "Windows.Foundation.Collections.IMapView" ; |
1021 | } |
1022 | pub trait IMapView_Impl<K, V>: IIterable_Impl<IKeyValuePair<K, V>> |
1023 | where |
1024 | K: windows_core::RuntimeType + 'static, |
1025 | V: windows_core::RuntimeType + 'static, |
1026 | { |
1027 | fn Lookup(&self, key: windows_core::Ref<'_, K>) -> windows_core::Result<V>; |
1028 | fn Size(&self) -> windows_core::Result<u32>; |
1029 | fn HasKey(&self, key: windows_core::Ref<'_, K>) -> windows_core::Result<bool>; |
1030 | fn Split( |
1031 | &self, |
1032 | first: windows_core::OutRef<'_, IMapView<K, V>>, |
1033 | second: windows_core::OutRef<'_, IMapView<K, V>>, |
1034 | ) -> windows_core::Result<()>; |
1035 | } |
1036 | impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> |
1037 | IMapView_Vtbl<K, V> |
1038 | { |
1039 | pub const fn new<Identity: IMapView_Impl<K, V>, const OFFSET: isize>() -> Self { |
1040 | unsafe extern "system" fn Lookup< |
1041 | K: windows_core::RuntimeType + 'static, |
1042 | V: windows_core::RuntimeType + 'static, |
1043 | Identity: IMapView_Impl<K, V>, |
1044 | const OFFSET: isize, |
1045 | >( |
1046 | this: *mut core::ffi::c_void, |
1047 | key: windows_core::AbiType<K>, |
1048 | result__: *mut windows_core::AbiType<V>, |
1049 | ) -> windows_core::HRESULT { |
1050 | unsafe { |
1051 | let this: &Identity = |
1052 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1053 | match IMapView_Impl::Lookup(this, core::mem::transmute_copy(&key)) { |
1054 | Ok(ok__) => { |
1055 | result__.write(core::mem::transmute_copy(&ok__)); |
1056 | core::mem::forget(ok__); |
1057 | windows_core::HRESULT(0) |
1058 | } |
1059 | Err(err) => err.into(), |
1060 | } |
1061 | } |
1062 | } |
1063 | unsafe extern "system" fn Size< |
1064 | K: windows_core::RuntimeType + 'static, |
1065 | V: windows_core::RuntimeType + 'static, |
1066 | Identity: IMapView_Impl<K, V>, |
1067 | const OFFSET: isize, |
1068 | >( |
1069 | this: *mut core::ffi::c_void, |
1070 | result__: *mut u32, |
1071 | ) -> windows_core::HRESULT { |
1072 | unsafe { |
1073 | let this: &Identity = |
1074 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1075 | match IMapView_Impl::Size(this) { |
1076 | Ok(ok__) => { |
1077 | result__.write(core::mem::transmute_copy(&ok__)); |
1078 | windows_core::HRESULT(0) |
1079 | } |
1080 | Err(err) => err.into(), |
1081 | } |
1082 | } |
1083 | } |
1084 | unsafe extern "system" fn HasKey< |
1085 | K: windows_core::RuntimeType + 'static, |
1086 | V: windows_core::RuntimeType + 'static, |
1087 | Identity: IMapView_Impl<K, V>, |
1088 | const OFFSET: isize, |
1089 | >( |
1090 | this: *mut core::ffi::c_void, |
1091 | key: windows_core::AbiType<K>, |
1092 | result__: *mut bool, |
1093 | ) -> windows_core::HRESULT { |
1094 | unsafe { |
1095 | let this: &Identity = |
1096 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1097 | match IMapView_Impl::HasKey(this, core::mem::transmute_copy(&key)) { |
1098 | Ok(ok__) => { |
1099 | result__.write(core::mem::transmute_copy(&ok__)); |
1100 | windows_core::HRESULT(0) |
1101 | } |
1102 | Err(err) => err.into(), |
1103 | } |
1104 | } |
1105 | } |
1106 | unsafe extern "system" fn Split< |
1107 | K: windows_core::RuntimeType + 'static, |
1108 | V: windows_core::RuntimeType + 'static, |
1109 | Identity: IMapView_Impl<K, V>, |
1110 | const OFFSET: isize, |
1111 | >( |
1112 | this: *mut core::ffi::c_void, |
1113 | first: *mut *mut core::ffi::c_void, |
1114 | second: *mut *mut core::ffi::c_void, |
1115 | ) -> windows_core::HRESULT { |
1116 | unsafe { |
1117 | let this: &Identity = |
1118 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1119 | IMapView_Impl::Split( |
1120 | this, |
1121 | core::mem::transmute_copy(&first), |
1122 | core::mem::transmute_copy(&second), |
1123 | ) |
1124 | .into() |
1125 | } |
1126 | } |
1127 | Self { |
1128 | base__: windows_core::IInspectable_Vtbl::new::<Identity, IMapView<K, V>, OFFSET>(), |
1129 | Lookup: Lookup::<K, V, Identity, OFFSET>, |
1130 | Size: Size::<K, V, Identity, OFFSET>, |
1131 | HasKey: HasKey::<K, V, Identity, OFFSET>, |
1132 | Split: Split::<K, V, Identity, OFFSET>, |
1133 | K: core::marker::PhantomData::<K>, |
1134 | V: core::marker::PhantomData::<V>, |
1135 | } |
1136 | } |
1137 | pub fn matches(iid: &windows_core::GUID) -> bool { |
1138 | iid == &<IMapView<K, V> as windows_core::Interface>::IID |
1139 | } |
1140 | } |
1141 | #[repr (C)] |
1142 | #[doc (hidden)] |
1143 | pub struct IMapView_Vtbl<K, V> |
1144 | where |
1145 | K: windows_core::RuntimeType + 'static, |
1146 | V: windows_core::RuntimeType + 'static, |
1147 | { |
1148 | pub base__: windows_core::IInspectable_Vtbl, |
1149 | pub Lookup: unsafe extern "system" fn( |
1150 | *mut core::ffi::c_void, |
1151 | windows_core::AbiType<K>, |
1152 | *mut windows_core::AbiType<V>, |
1153 | ) -> windows_core::HRESULT, |
1154 | pub Size: unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> windows_core::HRESULT, |
1155 | pub HasKey: unsafe extern "system" fn( |
1156 | *mut core::ffi::c_void, |
1157 | windows_core::AbiType<K>, |
1158 | *mut bool, |
1159 | ) -> windows_core::HRESULT, |
1160 | pub Split: unsafe extern "system" fn( |
1161 | *mut core::ffi::c_void, |
1162 | *mut *mut core::ffi::c_void, |
1163 | *mut *mut core::ffi::c_void, |
1164 | ) -> windows_core::HRESULT, |
1165 | K: core::marker::PhantomData<K>, |
1166 | V: core::marker::PhantomData<V>, |
1167 | } |
1168 | #[repr (transparent)] |
1169 | #[derive (Clone, Debug, Eq, PartialEq)] |
1170 | pub struct IVector<T>(windows_core::IUnknown, core::marker::PhantomData<T>) |
1171 | where |
1172 | T: windows_core::RuntimeType + 'static; |
1173 | impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IUnknown> |
1174 | for IVector<T> |
1175 | { |
1176 | } |
1177 | impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IInspectable> |
1178 | for IVector<T> |
1179 | { |
1180 | } |
1181 | unsafe impl<T: windows_core::RuntimeType + 'static> windows_core::Interface for IVector<T> { |
1182 | type Vtable = IVector_Vtbl<T>; |
1183 | const IID: windows_core::GUID = |
1184 | windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE); |
1185 | } |
1186 | impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeType for IVector<T> { |
1187 | const SIGNATURE: windows_core::imp::ConstBuffer = windows_coreConstBuffer::imp::ConstBuffer::new() |
1188 | .push_slice(b"pinterface({913337e9-11a1-4345-a3a2-4e7f956e222d}" ) |
1189 | .push_slice(b";" ) |
1190 | .push_other(T::SIGNATURE) |
1191 | .push_slice(b")" ); |
1192 | } |
1193 | impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<IIterable<T>> |
1194 | for IVector<T> |
1195 | { |
1196 | const QUERY: bool = true; |
1197 | } |
1198 | impl<T: windows_core::RuntimeType + 'static> IVector<T> { |
1199 | pub fn GetAt(&self, index: u32) -> windows_core::Result<T> { |
1200 | let this = self; |
1201 | unsafe { |
1202 | let mut result__ = core::mem::zeroed(); |
1203 | (windows_core::Interface::vtable(this).GetAt)( |
1204 | windows_core::Interface::as_raw(this), |
1205 | index, |
1206 | &mut result__, |
1207 | ) |
1208 | .and_then(|| windows_core::Type::from_abi(result__)) |
1209 | } |
1210 | } |
1211 | pub fn Size(&self) -> windows_core::Result<u32> { |
1212 | let this = self; |
1213 | unsafe { |
1214 | let mut result__ = core::mem::zeroed(); |
1215 | (windows_core::Interface::vtable(this).Size)( |
1216 | windows_core::Interface::as_raw(this), |
1217 | &mut result__, |
1218 | ) |
1219 | .map(|| result__) |
1220 | } |
1221 | } |
1222 | pub fn GetView(&self) -> windows_core::Result<IVectorView<T>> { |
1223 | let this = self; |
1224 | unsafe { |
1225 | let mut result__ = core::mem::zeroed(); |
1226 | (windows_core::Interface::vtable(this).GetView)( |
1227 | windows_core::Interface::as_raw(this), |
1228 | &mut result__, |
1229 | ) |
1230 | .and_then(|| windows_core::Type::from_abi(result__)) |
1231 | } |
1232 | } |
1233 | pub fn IndexOf<P0>(&self, value: P0, index: &mut u32) -> windows_core::Result<bool> |
1234 | where |
1235 | P0: windows_core::Param<T>, |
1236 | { |
1237 | let this = self; |
1238 | unsafe { |
1239 | let mut result__ = core::mem::zeroed(); |
1240 | (windows_core::Interface::vtable(this).IndexOf)( |
1241 | windows_core::Interface::as_raw(this), |
1242 | value.param().abi(), |
1243 | index, |
1244 | &mut result__, |
1245 | ) |
1246 | .map(|| result__) |
1247 | } |
1248 | } |
1249 | pub fn SetAt<P1>(&self, index: u32, value: P1) -> windows_core::Result<()> |
1250 | where |
1251 | P1: windows_core::Param<T>, |
1252 | { |
1253 | let this = self; |
1254 | unsafe { |
1255 | (windows_core::Interface::vtable(this).SetAt)( |
1256 | windows_core::Interface::as_raw(this), |
1257 | index, |
1258 | value.param().abi(), |
1259 | ) |
1260 | .ok() |
1261 | } |
1262 | } |
1263 | pub fn InsertAt<P1>(&self, index: u32, value: P1) -> windows_core::Result<()> |
1264 | where |
1265 | P1: windows_core::Param<T>, |
1266 | { |
1267 | let this = self; |
1268 | unsafe { |
1269 | (windows_core::Interface::vtable(this).InsertAt)( |
1270 | windows_core::Interface::as_raw(this), |
1271 | index, |
1272 | value.param().abi(), |
1273 | ) |
1274 | .ok() |
1275 | } |
1276 | } |
1277 | pub fn RemoveAt(&self, index: u32) -> windows_core::Result<()> { |
1278 | let this = self; |
1279 | unsafe { |
1280 | (windows_core::Interface::vtable(this).RemoveAt)( |
1281 | windows_core::Interface::as_raw(this), |
1282 | index, |
1283 | ) |
1284 | .ok() |
1285 | } |
1286 | } |
1287 | pub fn Append<P0>(&self, value: P0) -> windows_core::Result<()> |
1288 | where |
1289 | P0: windows_core::Param<T>, |
1290 | { |
1291 | let this = self; |
1292 | unsafe { |
1293 | (windows_core::Interface::vtable(this).Append)( |
1294 | windows_core::Interface::as_raw(this), |
1295 | value.param().abi(), |
1296 | ) |
1297 | .ok() |
1298 | } |
1299 | } |
1300 | pub fn RemoveAtEnd(&self) -> windows_core::Result<()> { |
1301 | let this = self; |
1302 | unsafe { |
1303 | (windows_core::Interface::vtable(this).RemoveAtEnd)(windows_core::Interface::as_raw( |
1304 | this, |
1305 | )) |
1306 | .ok() |
1307 | } |
1308 | } |
1309 | pub fn Clear(&self) -> windows_core::Result<()> { |
1310 | let this = self; |
1311 | unsafe { |
1312 | (windows_core::Interface::vtable(this).Clear)(windows_core::Interface::as_raw(this)) |
1313 | .ok() |
1314 | } |
1315 | } |
1316 | pub fn GetMany( |
1317 | &self, |
1318 | startindex: u32, |
1319 | items: &mut [<T as windows_core::Type<T>>::Default], |
1320 | ) -> windows_core::Result<u32> { |
1321 | let this = self; |
1322 | unsafe { |
1323 | let mut result__ = core::mem::zeroed(); |
1324 | (windows_core::Interface::vtable(this).GetMany)( |
1325 | windows_core::Interface::as_raw(this), |
1326 | startindex, |
1327 | items.len().try_into().unwrap(), |
1328 | core::mem::transmute_copy(&items), |
1329 | &mut result__, |
1330 | ) |
1331 | .map(|| result__) |
1332 | } |
1333 | } |
1334 | pub fn ReplaceAll( |
1335 | &self, |
1336 | items: &[<T as windows_core::Type<T>>::Default], |
1337 | ) -> windows_core::Result<()> { |
1338 | let this = self; |
1339 | unsafe { |
1340 | (windows_core::Interface::vtable(this).ReplaceAll)( |
1341 | windows_core::Interface::as_raw(this), |
1342 | items.len().try_into().unwrap(), |
1343 | core::mem::transmute(items.as_ptr()), |
1344 | ) |
1345 | .ok() |
1346 | } |
1347 | } |
1348 | pub fn First(&self) -> windows_core::Result<IIterator<T>> { |
1349 | let this = &windows_core::Interface::cast::<IIterable<T>>(self)?; |
1350 | unsafe { |
1351 | let mut result__ = core::mem::zeroed(); |
1352 | (windows_core::Interface::vtable(this).First)( |
1353 | windows_core::Interface::as_raw(this), |
1354 | &mut result__, |
1355 | ) |
1356 | .and_then(|| windows_core::Type::from_abi(result__)) |
1357 | } |
1358 | } |
1359 | } |
1360 | impl<T: windows_core::RuntimeType + 'static> IntoIterator for IVector<T> { |
1361 | type Item = T; |
1362 | type IntoIter = IIterator<Self::Item>; |
1363 | fn into_iter(self) -> Self::IntoIter { |
1364 | IntoIterator::into_iter(&self) |
1365 | } |
1366 | } |
1367 | impl<T: windows_core::RuntimeType + 'static> IntoIterator for &IVector<T> { |
1368 | type Item = T; |
1369 | type IntoIter = IIterator<Self::Item>; |
1370 | fn into_iter(self) -> Self::IntoIter { |
1371 | self.First().unwrap() |
1372 | } |
1373 | } |
1374 | impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeName for IVector<T> { |
1375 | const NAME: &'static str = "Windows.Foundation.Collections.IVector" ; |
1376 | } |
1377 | pub trait IVector_Impl<T>: IIterable_Impl<T> |
1378 | where |
1379 | T: windows_core::RuntimeType + 'static, |
1380 | { |
1381 | fn GetAt(&self, index: u32) -> windows_core::Result<T>; |
1382 | fn Size(&self) -> windows_core::Result<u32>; |
1383 | fn GetView(&self) -> windows_core::Result<IVectorView<T>>; |
1384 | fn IndexOf( |
1385 | &self, |
1386 | value: windows_core::Ref<'_, T>, |
1387 | index: &mut u32, |
1388 | ) -> windows_core::Result<bool>; |
1389 | fn SetAt(&self, index: u32, value: windows_core::Ref<'_, T>) -> windows_core::Result<()>; |
1390 | fn InsertAt(&self, index: u32, value: windows_core::Ref<'_, T>) -> windows_core::Result<()>; |
1391 | fn RemoveAt(&self, index: u32) -> windows_core::Result<()>; |
1392 | fn Append(&self, value: windows_core::Ref<'_, T>) -> windows_core::Result<()>; |
1393 | fn RemoveAtEnd(&self) -> windows_core::Result<()>; |
1394 | fn Clear(&self) -> windows_core::Result<()>; |
1395 | fn GetMany( |
1396 | &self, |
1397 | startIndex: u32, |
1398 | items: &mut [<T as windows_core::Type<T>>::Default], |
1399 | ) -> windows_core::Result<u32>; |
1400 | fn ReplaceAll( |
1401 | &self, |
1402 | items: &[<T as windows_core::Type<T>>::Default], |
1403 | ) -> windows_core::Result<()>; |
1404 | } |
1405 | impl<T: windows_core::RuntimeType + 'static> IVector_Vtbl<T> { |
1406 | pub const fn new<Identity: IVector_Impl<T>, const OFFSET: isize>() -> Self { |
1407 | unsafe extern "system" fn GetAt< |
1408 | T: windows_core::RuntimeType + 'static, |
1409 | Identity: IVector_Impl<T>, |
1410 | const OFFSET: isize, |
1411 | >( |
1412 | this: *mut core::ffi::c_void, |
1413 | index: u32, |
1414 | result__: *mut windows_core::AbiType<T>, |
1415 | ) -> windows_core::HRESULT { |
1416 | unsafe { |
1417 | let this: &Identity = |
1418 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1419 | match IVector_Impl::GetAt(this, index) { |
1420 | Ok(ok__) => { |
1421 | result__.write(core::mem::transmute_copy(&ok__)); |
1422 | core::mem::forget(ok__); |
1423 | windows_core::HRESULT(0) |
1424 | } |
1425 | Err(err) => err.into(), |
1426 | } |
1427 | } |
1428 | } |
1429 | unsafe extern "system" fn Size< |
1430 | T: windows_core::RuntimeType + 'static, |
1431 | Identity: IVector_Impl<T>, |
1432 | const OFFSET: isize, |
1433 | >( |
1434 | this: *mut core::ffi::c_void, |
1435 | result__: *mut u32, |
1436 | ) -> windows_core::HRESULT { |
1437 | unsafe { |
1438 | let this: &Identity = |
1439 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1440 | match IVector_Impl::Size(this) { |
1441 | Ok(ok__) => { |
1442 | result__.write(core::mem::transmute_copy(&ok__)); |
1443 | windows_core::HRESULT(0) |
1444 | } |
1445 | Err(err) => err.into(), |
1446 | } |
1447 | } |
1448 | } |
1449 | unsafe extern "system" fn GetView< |
1450 | T: windows_core::RuntimeType + 'static, |
1451 | Identity: IVector_Impl<T>, |
1452 | const OFFSET: isize, |
1453 | >( |
1454 | this: *mut core::ffi::c_void, |
1455 | result__: *mut *mut core::ffi::c_void, |
1456 | ) -> windows_core::HRESULT { |
1457 | unsafe { |
1458 | let this: &Identity = |
1459 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1460 | match IVector_Impl::GetView(this) { |
1461 | Ok(ok__) => { |
1462 | result__.write(core::mem::transmute_copy(&ok__)); |
1463 | core::mem::forget(ok__); |
1464 | windows_core::HRESULT(0) |
1465 | } |
1466 | Err(err) => err.into(), |
1467 | } |
1468 | } |
1469 | } |
1470 | unsafe extern "system" fn IndexOf< |
1471 | T: windows_core::RuntimeType + 'static, |
1472 | Identity: IVector_Impl<T>, |
1473 | const OFFSET: isize, |
1474 | >( |
1475 | this: *mut core::ffi::c_void, |
1476 | value: windows_core::AbiType<T>, |
1477 | index: *mut u32, |
1478 | result__: *mut bool, |
1479 | ) -> windows_core::HRESULT { |
1480 | unsafe { |
1481 | let this: &Identity = |
1482 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1483 | match IVector_Impl::IndexOf( |
1484 | this, |
1485 | core::mem::transmute_copy(&value), |
1486 | core::mem::transmute_copy(&index), |
1487 | ) { |
1488 | Ok(ok__) => { |
1489 | result__.write(core::mem::transmute_copy(&ok__)); |
1490 | windows_core::HRESULT(0) |
1491 | } |
1492 | Err(err) => err.into(), |
1493 | } |
1494 | } |
1495 | } |
1496 | unsafe extern "system" fn SetAt< |
1497 | T: windows_core::RuntimeType + 'static, |
1498 | Identity: IVector_Impl<T>, |
1499 | const OFFSET: isize, |
1500 | >( |
1501 | this: *mut core::ffi::c_void, |
1502 | index: u32, |
1503 | value: windows_core::AbiType<T>, |
1504 | ) -> windows_core::HRESULT { |
1505 | unsafe { |
1506 | let this: &Identity = |
1507 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1508 | IVector_Impl::SetAt(this, index, core::mem::transmute_copy(&value)).into() |
1509 | } |
1510 | } |
1511 | unsafe extern "system" fn InsertAt< |
1512 | T: windows_core::RuntimeType + 'static, |
1513 | Identity: IVector_Impl<T>, |
1514 | const OFFSET: isize, |
1515 | >( |
1516 | this: *mut core::ffi::c_void, |
1517 | index: u32, |
1518 | value: windows_core::AbiType<T>, |
1519 | ) -> windows_core::HRESULT { |
1520 | unsafe { |
1521 | let this: &Identity = |
1522 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1523 | IVector_Impl::InsertAt(this, index, core::mem::transmute_copy(&value)).into() |
1524 | } |
1525 | } |
1526 | unsafe extern "system" fn RemoveAt< |
1527 | T: windows_core::RuntimeType + 'static, |
1528 | Identity: IVector_Impl<T>, |
1529 | const OFFSET: isize, |
1530 | >( |
1531 | this: *mut core::ffi::c_void, |
1532 | index: u32, |
1533 | ) -> windows_core::HRESULT { |
1534 | unsafe { |
1535 | let this: &Identity = |
1536 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1537 | IVector_Impl::RemoveAt(this, index).into() |
1538 | } |
1539 | } |
1540 | unsafe extern "system" fn Append< |
1541 | T: windows_core::RuntimeType + 'static, |
1542 | Identity: IVector_Impl<T>, |
1543 | const OFFSET: isize, |
1544 | >( |
1545 | this: *mut core::ffi::c_void, |
1546 | value: windows_core::AbiType<T>, |
1547 | ) -> windows_core::HRESULT { |
1548 | unsafe { |
1549 | let this: &Identity = |
1550 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1551 | IVector_Impl::Append(this, core::mem::transmute_copy(&value)).into() |
1552 | } |
1553 | } |
1554 | unsafe extern "system" fn RemoveAtEnd< |
1555 | T: windows_core::RuntimeType + 'static, |
1556 | Identity: IVector_Impl<T>, |
1557 | const OFFSET: isize, |
1558 | >( |
1559 | this: *mut core::ffi::c_void, |
1560 | ) -> windows_core::HRESULT { |
1561 | unsafe { |
1562 | let this: &Identity = |
1563 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1564 | IVector_Impl::RemoveAtEnd(this).into() |
1565 | } |
1566 | } |
1567 | unsafe extern "system" fn Clear< |
1568 | T: windows_core::RuntimeType + 'static, |
1569 | Identity: IVector_Impl<T>, |
1570 | const OFFSET: isize, |
1571 | >( |
1572 | this: *mut core::ffi::c_void, |
1573 | ) -> windows_core::HRESULT { |
1574 | unsafe { |
1575 | let this: &Identity = |
1576 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1577 | IVector_Impl::Clear(this).into() |
1578 | } |
1579 | } |
1580 | unsafe extern "system" fn GetMany< |
1581 | T: windows_core::RuntimeType + 'static, |
1582 | Identity: IVector_Impl<T>, |
1583 | const OFFSET: isize, |
1584 | >( |
1585 | this: *mut core::ffi::c_void, |
1586 | startindex: u32, |
1587 | items_array_size: u32, |
1588 | items: *mut T, |
1589 | result__: *mut u32, |
1590 | ) -> windows_core::HRESULT { |
1591 | unsafe { |
1592 | let this: &Identity = |
1593 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1594 | match IVector_Impl::GetMany( |
1595 | this, |
1596 | startindex, |
1597 | core::slice::from_raw_parts_mut( |
1598 | core::mem::transmute_copy(&items), |
1599 | items_array_size as usize, |
1600 | ), |
1601 | ) { |
1602 | Ok(ok__) => { |
1603 | result__.write(core::mem::transmute_copy(&ok__)); |
1604 | windows_core::HRESULT(0) |
1605 | } |
1606 | Err(err) => err.into(), |
1607 | } |
1608 | } |
1609 | } |
1610 | unsafe extern "system" fn ReplaceAll< |
1611 | T: windows_core::RuntimeType + 'static, |
1612 | Identity: IVector_Impl<T>, |
1613 | const OFFSET: isize, |
1614 | >( |
1615 | this: *mut core::ffi::c_void, |
1616 | items_array_size: u32, |
1617 | items: *const T, |
1618 | ) -> windows_core::HRESULT { |
1619 | unsafe { |
1620 | let this: &Identity = |
1621 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1622 | IVector_Impl::ReplaceAll( |
1623 | this, |
1624 | core::slice::from_raw_parts( |
1625 | core::mem::transmute_copy(&items), |
1626 | items_array_size as usize, |
1627 | ), |
1628 | ) |
1629 | .into() |
1630 | } |
1631 | } |
1632 | Self { |
1633 | base__: windows_core::IInspectable_Vtbl::new::<Identity, IVector<T>, OFFSET>(), |
1634 | GetAt: GetAt::<T, Identity, OFFSET>, |
1635 | Size: Size::<T, Identity, OFFSET>, |
1636 | GetView: GetView::<T, Identity, OFFSET>, |
1637 | IndexOf: IndexOf::<T, Identity, OFFSET>, |
1638 | SetAt: SetAt::<T, Identity, OFFSET>, |
1639 | InsertAt: InsertAt::<T, Identity, OFFSET>, |
1640 | RemoveAt: RemoveAt::<T, Identity, OFFSET>, |
1641 | Append: Append::<T, Identity, OFFSET>, |
1642 | RemoveAtEnd: RemoveAtEnd::<T, Identity, OFFSET>, |
1643 | Clear: Clear::<T, Identity, OFFSET>, |
1644 | GetMany: GetMany::<T, Identity, OFFSET>, |
1645 | ReplaceAll: ReplaceAll::<T, Identity, OFFSET>, |
1646 | T: core::marker::PhantomData::<T>, |
1647 | } |
1648 | } |
1649 | pub fn matches(iid: &windows_core::GUID) -> bool { |
1650 | iid == &<IVector<T> as windows_core::Interface>::IID |
1651 | } |
1652 | } |
1653 | #[repr (C)] |
1654 | #[doc (hidden)] |
1655 | pub struct IVector_Vtbl<T> |
1656 | where |
1657 | T: windows_core::RuntimeType + 'static, |
1658 | { |
1659 | pub base__: windows_core::IInspectable_Vtbl, |
1660 | pub GetAt: unsafe extern "system" fn( |
1661 | *mut core::ffi::c_void, |
1662 | u32, |
1663 | *mut windows_core::AbiType<T>, |
1664 | ) -> windows_core::HRESULT, |
1665 | pub Size: unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> windows_core::HRESULT, |
1666 | pub GetView: unsafe extern "system" fn( |
1667 | *mut core::ffi::c_void, |
1668 | *mut *mut core::ffi::c_void, |
1669 | ) -> windows_core::HRESULT, |
1670 | pub IndexOf: unsafe extern "system" fn( |
1671 | *mut core::ffi::c_void, |
1672 | windows_core::AbiType<T>, |
1673 | *mut u32, |
1674 | *mut bool, |
1675 | ) -> windows_core::HRESULT, |
1676 | pub SetAt: unsafe extern "system" fn( |
1677 | *mut core::ffi::c_void, |
1678 | u32, |
1679 | windows_core::AbiType<T>, |
1680 | ) -> windows_core::HRESULT, |
1681 | pub InsertAt: unsafe extern "system" fn( |
1682 | *mut core::ffi::c_void, |
1683 | u32, |
1684 | windows_core::AbiType<T>, |
1685 | ) -> windows_core::HRESULT, |
1686 | pub RemoveAt: unsafe extern "system" fn(*mut core::ffi::c_void, u32) -> windows_core::HRESULT, |
1687 | pub Append: unsafe extern "system" fn( |
1688 | *mut core::ffi::c_void, |
1689 | windows_core::AbiType<T>, |
1690 | ) -> windows_core::HRESULT, |
1691 | pub RemoveAtEnd: unsafe extern "system" fn(*mut core::ffi::c_void) -> windows_core::HRESULT, |
1692 | pub Clear: unsafe extern "system" fn(*mut core::ffi::c_void) -> windows_core::HRESULT, |
1693 | pub GetMany: unsafe extern "system" fn( |
1694 | *mut core::ffi::c_void, |
1695 | u32, |
1696 | u32, |
1697 | *mut T, |
1698 | *mut u32, |
1699 | ) -> windows_core::HRESULT, |
1700 | pub ReplaceAll: |
1701 | unsafe extern "system" fn(*mut core::ffi::c_void, u32, *const T) -> windows_core::HRESULT, |
1702 | T: core::marker::PhantomData<T>, |
1703 | } |
1704 | #[repr (transparent)] |
1705 | #[derive (Clone, Debug, Eq, PartialEq)] |
1706 | pub struct IVectorView<T>(windows_core::IUnknown, core::marker::PhantomData<T>) |
1707 | where |
1708 | T: windows_core::RuntimeType + 'static; |
1709 | impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IUnknown> |
1710 | for IVectorView<T> |
1711 | { |
1712 | } |
1713 | impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IInspectable> |
1714 | for IVectorView<T> |
1715 | { |
1716 | } |
1717 | unsafe impl<T: windows_core::RuntimeType + 'static> windows_core::Interface for IVectorView<T> { |
1718 | type Vtable = IVectorView_Vtbl<T>; |
1719 | const IID: windows_core::GUID = |
1720 | windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE); |
1721 | } |
1722 | impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeType for IVectorView<T> { |
1723 | const SIGNATURE: windows_core::imp::ConstBuffer = windows_coreConstBuffer::imp::ConstBuffer::new() |
1724 | .push_slice(b"pinterface({bbe1fa4c-b0e3-4583-baef-1f1b2e483e56}" ) |
1725 | .push_slice(b";" ) |
1726 | .push_other(T::SIGNATURE) |
1727 | .push_slice(b")" ); |
1728 | } |
1729 | impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<IIterable<T>> |
1730 | for IVectorView<T> |
1731 | { |
1732 | const QUERY: bool = true; |
1733 | } |
1734 | impl<T: windows_core::RuntimeType + 'static> IVectorView<T> { |
1735 | pub fn GetAt(&self, index: u32) -> windows_core::Result<T> { |
1736 | let this = self; |
1737 | unsafe { |
1738 | let mut result__ = core::mem::zeroed(); |
1739 | (windows_core::Interface::vtable(this).GetAt)( |
1740 | windows_core::Interface::as_raw(this), |
1741 | index, |
1742 | &mut result__, |
1743 | ) |
1744 | .and_then(|| windows_core::Type::from_abi(result__)) |
1745 | } |
1746 | } |
1747 | pub fn Size(&self) -> windows_core::Result<u32> { |
1748 | let this = self; |
1749 | unsafe { |
1750 | let mut result__ = core::mem::zeroed(); |
1751 | (windows_core::Interface::vtable(this).Size)( |
1752 | windows_core::Interface::as_raw(this), |
1753 | &mut result__, |
1754 | ) |
1755 | .map(|| result__) |
1756 | } |
1757 | } |
1758 | pub fn IndexOf<P0>(&self, value: P0, index: &mut u32) -> windows_core::Result<bool> |
1759 | where |
1760 | P0: windows_core::Param<T>, |
1761 | { |
1762 | let this = self; |
1763 | unsafe { |
1764 | let mut result__ = core::mem::zeroed(); |
1765 | (windows_core::Interface::vtable(this).IndexOf)( |
1766 | windows_core::Interface::as_raw(this), |
1767 | value.param().abi(), |
1768 | index, |
1769 | &mut result__, |
1770 | ) |
1771 | .map(|| result__) |
1772 | } |
1773 | } |
1774 | pub fn GetMany( |
1775 | &self, |
1776 | startindex: u32, |
1777 | items: &mut [<T as windows_core::Type<T>>::Default], |
1778 | ) -> windows_core::Result<u32> { |
1779 | let this = self; |
1780 | unsafe { |
1781 | let mut result__ = core::mem::zeroed(); |
1782 | (windows_core::Interface::vtable(this).GetMany)( |
1783 | windows_core::Interface::as_raw(this), |
1784 | startindex, |
1785 | items.len().try_into().unwrap(), |
1786 | core::mem::transmute_copy(&items), |
1787 | &mut result__, |
1788 | ) |
1789 | .map(|| result__) |
1790 | } |
1791 | } |
1792 | pub fn First(&self) -> windows_core::Result<IIterator<T>> { |
1793 | let this = &windows_core::Interface::cast::<IIterable<T>>(self)?; |
1794 | unsafe { |
1795 | let mut result__ = core::mem::zeroed(); |
1796 | (windows_core::Interface::vtable(this).First)( |
1797 | windows_core::Interface::as_raw(this), |
1798 | &mut result__, |
1799 | ) |
1800 | .and_then(|| windows_core::Type::from_abi(result__)) |
1801 | } |
1802 | } |
1803 | } |
1804 | impl<T: windows_core::RuntimeType + 'static> IntoIterator for IVectorView<T> { |
1805 | type Item = T; |
1806 | type IntoIter = IIterator<Self::Item>; |
1807 | fn into_iter(self) -> Self::IntoIter { |
1808 | IntoIterator::into_iter(&self) |
1809 | } |
1810 | } |
1811 | impl<T: windows_core::RuntimeType + 'static> IntoIterator for &IVectorView<T> { |
1812 | type Item = T; |
1813 | type IntoIter = IIterator<Self::Item>; |
1814 | fn into_iter(self) -> Self::IntoIter { |
1815 | self.First().unwrap() |
1816 | } |
1817 | } |
1818 | impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeName for IVectorView<T> { |
1819 | const NAME: &'static str = "Windows.Foundation.Collections.IVectorView" ; |
1820 | } |
1821 | pub trait IVectorView_Impl<T>: IIterable_Impl<T> |
1822 | where |
1823 | T: windows_core::RuntimeType + 'static, |
1824 | { |
1825 | fn GetAt(&self, index: u32) -> windows_core::Result<T>; |
1826 | fn Size(&self) -> windows_core::Result<u32>; |
1827 | fn IndexOf( |
1828 | &self, |
1829 | value: windows_core::Ref<'_, T>, |
1830 | index: &mut u32, |
1831 | ) -> windows_core::Result<bool>; |
1832 | fn GetMany( |
1833 | &self, |
1834 | startIndex: u32, |
1835 | items: &mut [<T as windows_core::Type<T>>::Default], |
1836 | ) -> windows_core::Result<u32>; |
1837 | } |
1838 | impl<T: windows_core::RuntimeType + 'static> IVectorView_Vtbl<T> { |
1839 | pub const fn new<Identity: IVectorView_Impl<T>, const OFFSET: isize>() -> Self { |
1840 | unsafe extern "system" fn GetAt< |
1841 | T: windows_core::RuntimeType + 'static, |
1842 | Identity: IVectorView_Impl<T>, |
1843 | const OFFSET: isize, |
1844 | >( |
1845 | this: *mut core::ffi::c_void, |
1846 | index: u32, |
1847 | result__: *mut windows_core::AbiType<T>, |
1848 | ) -> windows_core::HRESULT { |
1849 | unsafe { |
1850 | let this: &Identity = |
1851 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1852 | match IVectorView_Impl::GetAt(this, index) { |
1853 | Ok(ok__) => { |
1854 | result__.write(core::mem::transmute_copy(&ok__)); |
1855 | core::mem::forget(ok__); |
1856 | windows_core::HRESULT(0) |
1857 | } |
1858 | Err(err) => err.into(), |
1859 | } |
1860 | } |
1861 | } |
1862 | unsafe extern "system" fn Size< |
1863 | T: windows_core::RuntimeType + 'static, |
1864 | Identity: IVectorView_Impl<T>, |
1865 | const OFFSET: isize, |
1866 | >( |
1867 | this: *mut core::ffi::c_void, |
1868 | result__: *mut u32, |
1869 | ) -> windows_core::HRESULT { |
1870 | unsafe { |
1871 | let this: &Identity = |
1872 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1873 | match IVectorView_Impl::Size(this) { |
1874 | Ok(ok__) => { |
1875 | result__.write(core::mem::transmute_copy(&ok__)); |
1876 | windows_core::HRESULT(0) |
1877 | } |
1878 | Err(err) => err.into(), |
1879 | } |
1880 | } |
1881 | } |
1882 | unsafe extern "system" fn IndexOf< |
1883 | T: windows_core::RuntimeType + 'static, |
1884 | Identity: IVectorView_Impl<T>, |
1885 | const OFFSET: isize, |
1886 | >( |
1887 | this: *mut core::ffi::c_void, |
1888 | value: windows_core::AbiType<T>, |
1889 | index: *mut u32, |
1890 | result__: *mut bool, |
1891 | ) -> windows_core::HRESULT { |
1892 | unsafe { |
1893 | let this: &Identity = |
1894 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1895 | match IVectorView_Impl::IndexOf( |
1896 | this, |
1897 | core::mem::transmute_copy(&value), |
1898 | core::mem::transmute_copy(&index), |
1899 | ) { |
1900 | Ok(ok__) => { |
1901 | result__.write(core::mem::transmute_copy(&ok__)); |
1902 | windows_core::HRESULT(0) |
1903 | } |
1904 | Err(err) => err.into(), |
1905 | } |
1906 | } |
1907 | } |
1908 | unsafe extern "system" fn GetMany< |
1909 | T: windows_core::RuntimeType + 'static, |
1910 | Identity: IVectorView_Impl<T>, |
1911 | const OFFSET: isize, |
1912 | >( |
1913 | this: *mut core::ffi::c_void, |
1914 | startindex: u32, |
1915 | items_array_size: u32, |
1916 | items: *mut T, |
1917 | result__: *mut u32, |
1918 | ) -> windows_core::HRESULT { |
1919 | unsafe { |
1920 | let this: &Identity = |
1921 | &*((this as *const *const ()).offset(OFFSET) as *const Identity); |
1922 | match IVectorView_Impl::GetMany( |
1923 | this, |
1924 | startindex, |
1925 | core::slice::from_raw_parts_mut( |
1926 | core::mem::transmute_copy(&items), |
1927 | items_array_size as usize, |
1928 | ), |
1929 | ) { |
1930 | Ok(ok__) => { |
1931 | result__.write(core::mem::transmute_copy(&ok__)); |
1932 | windows_core::HRESULT(0) |
1933 | } |
1934 | Err(err) => err.into(), |
1935 | } |
1936 | } |
1937 | } |
1938 | Self { |
1939 | base__: windows_core::IInspectable_Vtbl::new::<Identity, IVectorView<T>, OFFSET>(), |
1940 | GetAt: GetAt::<T, Identity, OFFSET>, |
1941 | Size: Size::<T, Identity, OFFSET>, |
1942 | IndexOf: IndexOf::<T, Identity, OFFSET>, |
1943 | GetMany: GetMany::<T, Identity, OFFSET>, |
1944 | T: core::marker::PhantomData::<T>, |
1945 | } |
1946 | } |
1947 | pub fn matches(iid: &windows_core::GUID) -> bool { |
1948 | iid == &<IVectorView<T> as windows_core::Interface>::IID |
1949 | } |
1950 | } |
1951 | #[repr (C)] |
1952 | #[doc (hidden)] |
1953 | pub struct IVectorView_Vtbl<T> |
1954 | where |
1955 | T: windows_core::RuntimeType + 'static, |
1956 | { |
1957 | pub base__: windows_core::IInspectable_Vtbl, |
1958 | pub GetAt: unsafe extern "system" fn( |
1959 | *mut core::ffi::c_void, |
1960 | u32, |
1961 | *mut windows_core::AbiType<T>, |
1962 | ) -> windows_core::HRESULT, |
1963 | pub Size: unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> windows_core::HRESULT, |
1964 | pub IndexOf: unsafe extern "system" fn( |
1965 | *mut core::ffi::c_void, |
1966 | windows_core::AbiType<T>, |
1967 | *mut u32, |
1968 | *mut bool, |
1969 | ) -> windows_core::HRESULT, |
1970 | pub GetMany: unsafe extern "system" fn( |
1971 | *mut core::ffi::c_void, |
1972 | u32, |
1973 | u32, |
1974 | *mut T, |
1975 | *mut u32, |
1976 | ) -> windows_core::HRESULT, |
1977 | T: core::marker::PhantomData<T>, |
1978 | } |
1979 | |