1#[repr(transparent)]
2#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
3pub struct CollectionChange(pub i32);
4impl CollectionChange {
5 pub const Reset: Self = Self(0);
6 pub const ItemInserted: Self = Self(1);
7 pub const ItemRemoved: Self = Self(2);
8 pub const ItemChanged: Self = Self(3);
9}
10impl windows_core::imp::TypeKind for CollectionChange {
11 type TypeKind = windows_core::imp::CopyType;
12}
13impl windows_core::RuntimeType for CollectionChange {
14 const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::from_slice(
15 b"enum(Windows.Foundation.Collections.CollectionChange;i4)",
16 );
17 const NAME: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::from_slice(
18 b"Windows.Foundation.Collections.CollectionChange",
19 );
20}
21#[repr(transparent)]
22#[derive(Clone, Debug, Eq, PartialEq)]
23pub struct IIterable<T>(windows_core::IUnknown, core::marker::PhantomData<T>)
24where
25 T: windows_core::RuntimeType + 'static;
26impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IUnknown>
27 for IIterable<T>
28{
29}
30impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IInspectable>
31 for IIterable<T>
32{
33}
34unsafe impl<T: windows_core::RuntimeType + 'static> windows_core::Interface for IIterable<T> {
35 type Vtable = IIterable_Vtbl<T>;
36 const IID: windows_core::GUID =
37 windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE);
38}
39impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeType for IIterable<T> {
40 const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
41 .push_slice(b"pinterface({faa585ea-6214-4217-afda-7f46de5869b3}")
42 .push_slice(b";")
43 .push_other(T::SIGNATURE)
44 .push_slice(b")");
45 const NAME: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
46 .push_slice(b"Windows.Foundation.Collections.IIterable`1<")
47 .push_other(T::NAME)
48 .push_slice(b">");
49}
50impl<T: windows_core::RuntimeType + 'static> IIterable<T> {
51 pub fn First(&self) -> windows_core::Result<IIterator<T>> {
52 unsafe {
53 let mut result__ = core::mem::zeroed();
54 (windows_core::Interface::vtable(self).First)(
55 windows_core::Interface::as_raw(self),
56 &mut result__,
57 )
58 .and_then(|| windows_core::imp::Type::from_abi(result__))
59 }
60 }
61}
62impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeName for IIterable<T> {
63 const NAME: &'static str = "Windows.Foundation.Collections.IIterable";
64 const RUNTIME_CLASS_NAME: windows_core::imp::ConstBuffer =
65 <Self as windows_core::RuntimeType>::NAME;
66}
67pub trait IIterable_Impl<T>: windows_core::IUnknownImpl
68where
69 T: windows_core::RuntimeType + 'static,
70{
71 fn First(&self) -> windows_core::Result<IIterator<T>>;
72}
73impl<T: windows_core::RuntimeType + 'static> IIterable_Vtbl<T> {
74 pub const fn new<Identity: IIterable_Impl<T>, const OFFSET: isize>() -> Self {
75 unsafe extern "system" fn First<
76 T: windows_core::RuntimeType + 'static,
77 Identity: IIterable_Impl<T>,
78 const OFFSET: isize,
79 >(
80 this: *mut core::ffi::c_void,
81 result__: *mut *mut core::ffi::c_void,
82 ) -> windows_core::HRESULT {
83 unsafe {
84 let this: &Identity =
85 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
86 match IIterable_Impl::First(this) {
87 Ok(ok__) => {
88 result__.write(core::mem::transmute_copy(&ok__));
89 core::mem::forget(ok__);
90 windows_core::HRESULT(0)
91 }
92 Err(err) => err.into(),
93 }
94 }
95 }
96 Self {
97 base__: windows_core::IInspectable_Vtbl::new::<Identity, IIterable<T>, OFFSET>(),
98 First: First::<T, Identity, OFFSET>,
99 T: core::marker::PhantomData::<T>,
100 }
101 }
102 pub fn matches(iid: &windows_core::GUID) -> bool {
103 iid == &<IIterable<T> as windows_core::Interface>::IID
104 }
105}
106#[repr(C)]
107pub struct IIterable_Vtbl<T>
108where
109 T: windows_core::RuntimeType + 'static,
110{
111 pub base__: windows_core::IInspectable_Vtbl,
112 pub First: unsafe extern "system" fn(
113 *mut core::ffi::c_void,
114 *mut *mut core::ffi::c_void,
115 ) -> windows_core::HRESULT,
116 T: core::marker::PhantomData<T>,
117}
118impl<T: windows_core::RuntimeType> IntoIterator for IIterable<T> {
119 type Item = T;
120 type IntoIter = windows_collections::BufferedIterator<Self::Item>;
121 fn into_iter(self) -> Self::IntoIter {
122 IntoIterator::into_iter(&self)
123 }
124}
125impl<T: windows_core::RuntimeType> IntoIterator for &IIterable<T> {
126 type Item = T;
127 type IntoIter = windows_collections::BufferedIterator<Self::Item>;
128 fn into_iter(self) -> Self::IntoIter {
129 windows_collections::BufferedIterator::new(self.First().unwrap())
130 }
131}
132#[repr(transparent)]
133#[derive(Clone, Debug, Eq, PartialEq)]
134pub struct IIterator<T>(windows_core::IUnknown, core::marker::PhantomData<T>)
135where
136 T: windows_core::RuntimeType + 'static;
137impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IUnknown>
138 for IIterator<T>
139{
140}
141impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IInspectable>
142 for IIterator<T>
143{
144}
145unsafe impl<T: windows_core::RuntimeType + 'static> windows_core::Interface for IIterator<T> {
146 type Vtable = IIterator_Vtbl<T>;
147 const IID: windows_core::GUID =
148 windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE);
149}
150impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeType for IIterator<T> {
151 const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
152 .push_slice(b"pinterface({6a79e863-4300-459a-9966-cbb660963ee1}")
153 .push_slice(b";")
154 .push_other(T::SIGNATURE)
155 .push_slice(b")");
156 const NAME: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
157 .push_slice(b"Windows.Foundation.Collections.IIterator`1<")
158 .push_other(T::NAME)
159 .push_slice(b">");
160}
161impl<T: windows_core::RuntimeType + 'static> IIterator<T> {
162 pub fn Current(&self) -> windows_core::Result<T> {
163 unsafe {
164 let mut result__ = core::mem::zeroed();
165 (windows_core::Interface::vtable(self).Current)(
166 windows_core::Interface::as_raw(self),
167 &mut result__,
168 )
169 .and_then(|| windows_core::imp::Type::from_abi(result__))
170 }
171 }
172 pub fn HasCurrent(&self) -> windows_core::Result<bool> {
173 unsafe {
174 let mut result__ = core::mem::zeroed();
175 (windows_core::Interface::vtable(self).HasCurrent)(
176 windows_core::Interface::as_raw(self),
177 &mut result__,
178 )
179 .map(|| result__)
180 }
181 }
182 pub fn MoveNext(&self) -> windows_core::Result<bool> {
183 unsafe {
184 let mut result__ = core::mem::zeroed();
185 (windows_core::Interface::vtable(self).MoveNext)(
186 windows_core::Interface::as_raw(self),
187 &mut result__,
188 )
189 .map(|| result__)
190 }
191 }
192 pub fn GetMany(
193 &self,
194 items: &mut [<T as windows_core::imp::Type<T>>::Default],
195 ) -> windows_core::Result<u32> {
196 unsafe {
197 let mut result__ = core::mem::zeroed();
198 (windows_core::Interface::vtable(self).GetMany)(
199 windows_core::Interface::as_raw(self),
200 items.len().try_into().unwrap(),
201 core::mem::transmute_copy(&items),
202 &mut result__,
203 )
204 .map(|| result__)
205 }
206 }
207}
208impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeName for IIterator<T> {
209 const NAME: &'static str = "Windows.Foundation.Collections.IIterator";
210 const RUNTIME_CLASS_NAME: windows_core::imp::ConstBuffer =
211 <Self as windows_core::RuntimeType>::NAME;
212}
213pub trait IIterator_Impl<T>: windows_core::IUnknownImpl
214where
215 T: windows_core::RuntimeType + 'static,
216{
217 fn Current(&self) -> windows_core::Result<T>;
218 fn HasCurrent(&self) -> windows_core::Result<bool>;
219 fn MoveNext(&self) -> windows_core::Result<bool>;
220 fn GetMany(
221 &self,
222 items: &mut [<T as windows_core::imp::Type<T>>::Default],
223 ) -> windows_core::Result<u32>;
224}
225impl<T: windows_core::RuntimeType + 'static> IIterator_Vtbl<T> {
226 pub const fn new<Identity: IIterator_Impl<T>, const OFFSET: isize>() -> Self {
227 unsafe extern "system" fn Current<
228 T: windows_core::RuntimeType + 'static,
229 Identity: IIterator_Impl<T>,
230 const OFFSET: isize,
231 >(
232 this: *mut core::ffi::c_void,
233 result__: *mut windows_core::imp::AbiType<T>,
234 ) -> windows_core::HRESULT {
235 unsafe {
236 let this: &Identity =
237 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
238 match IIterator_Impl::Current(this) {
239 Ok(ok__) => {
240 result__.write(core::mem::transmute_copy(&ok__));
241 core::mem::forget(ok__);
242 windows_core::HRESULT(0)
243 }
244 Err(err) => err.into(),
245 }
246 }
247 }
248 unsafe extern "system" fn HasCurrent<
249 T: windows_core::RuntimeType + 'static,
250 Identity: IIterator_Impl<T>,
251 const OFFSET: isize,
252 >(
253 this: *mut core::ffi::c_void,
254 result__: *mut bool,
255 ) -> windows_core::HRESULT {
256 unsafe {
257 let this: &Identity =
258 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
259 match IIterator_Impl::HasCurrent(this) {
260 Ok(ok__) => {
261 result__.write(ok__);
262 windows_core::HRESULT(0)
263 }
264 Err(err) => err.into(),
265 }
266 }
267 }
268 unsafe extern "system" fn MoveNext<
269 T: windows_core::RuntimeType + 'static,
270 Identity: IIterator_Impl<T>,
271 const OFFSET: isize,
272 >(
273 this: *mut core::ffi::c_void,
274 result__: *mut bool,
275 ) -> windows_core::HRESULT {
276 unsafe {
277 let this: &Identity =
278 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
279 match IIterator_Impl::MoveNext(this) {
280 Ok(ok__) => {
281 result__.write(ok__);
282 windows_core::HRESULT(0)
283 }
284 Err(err) => err.into(),
285 }
286 }
287 }
288 unsafe extern "system" fn GetMany<
289 T: windows_core::RuntimeType + 'static,
290 Identity: IIterator_Impl<T>,
291 const OFFSET: isize,
292 >(
293 this: *mut core::ffi::c_void,
294 items_array_size: u32,
295 items: *mut windows_core::imp::AbiType<T>,
296 result__: *mut u32,
297 ) -> windows_core::HRESULT {
298 unsafe {
299 let this: &Identity =
300 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
301 match IIterator_Impl::GetMany(
302 this,
303 core::slice::from_raw_parts_mut(
304 core::mem::transmute_copy(&items),
305 items_array_size as usize,
306 ),
307 ) {
308 Ok(ok__) => {
309 result__.write(ok__);
310 windows_core::HRESULT(0)
311 }
312 Err(err) => err.into(),
313 }
314 }
315 }
316 Self {
317 base__: windows_core::IInspectable_Vtbl::new::<Identity, IIterator<T>, OFFSET>(),
318 Current: Current::<T, Identity, OFFSET>,
319 HasCurrent: HasCurrent::<T, Identity, OFFSET>,
320 MoveNext: MoveNext::<T, Identity, OFFSET>,
321 GetMany: GetMany::<T, Identity, OFFSET>,
322 T: core::marker::PhantomData::<T>,
323 }
324 }
325 pub fn matches(iid: &windows_core::GUID) -> bool {
326 iid == &<IIterator<T> as windows_core::Interface>::IID
327 }
328}
329#[repr(C)]
330pub struct IIterator_Vtbl<T>
331where
332 T: windows_core::RuntimeType + 'static,
333{
334 pub base__: windows_core::IInspectable_Vtbl,
335 pub Current: unsafe extern "system" fn(
336 *mut core::ffi::c_void,
337 *mut windows_core::imp::AbiType<T>,
338 ) -> windows_core::HRESULT,
339 pub HasCurrent:
340 unsafe extern "system" fn(*mut core::ffi::c_void, *mut bool) -> windows_core::HRESULT,
341 pub MoveNext:
342 unsafe extern "system" fn(*mut core::ffi::c_void, *mut bool) -> windows_core::HRESULT,
343 pub GetMany: unsafe extern "system" fn(
344 *mut core::ffi::c_void,
345 u32,
346 *mut windows_core::imp::AbiType<T>,
347 *mut u32,
348 ) -> windows_core::HRESULT,
349 T: core::marker::PhantomData<T>,
350}
351impl<T: windows_core::RuntimeType> Iterator for IIterator<T> {
352 type Item = T;
353 fn next(&mut self) -> Option<Self::Item> {
354 let result = if self.HasCurrent().unwrap_or(false) {
355 self.Current().ok()
356 } else {
357 None
358 };
359 if result.is_some() {
360 let _ = self.MoveNext();
361 }
362 result
363 }
364}
365#[repr(transparent)]
366#[derive(Clone, Debug, Eq, PartialEq)]
367pub struct IKeyValuePair<K, V>(
368 windows_core::IUnknown,
369 core::marker::PhantomData<K>,
370 core::marker::PhantomData<V>,
371)
372where
373 K: windows_core::RuntimeType + 'static,
374 V: windows_core::RuntimeType + 'static;
375impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
376 windows_core::imp::CanInto<windows_core::IUnknown> for IKeyValuePair<K, V>
377{
378}
379impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
380 windows_core::imp::CanInto<windows_core::IInspectable> for IKeyValuePair<K, V>
381{
382}
383unsafe impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
384 windows_core::Interface for IKeyValuePair<K, V>
385{
386 type Vtable = IKeyValuePair_Vtbl<K, V>;
387 const IID: windows_core::GUID =
388 windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE);
389}
390impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
391 windows_core::RuntimeType for IKeyValuePair<K, V>
392{
393 const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
394 .push_slice(b"pinterface({02b51929-c1c4-4a7e-8940-0312b5c18500}")
395 .push_slice(b";")
396 .push_other(K::SIGNATURE)
397 .push_slice(b";")
398 .push_other(V::SIGNATURE)
399 .push_slice(b")");
400 const NAME: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
401 .push_slice(b"Windows.Foundation.Collections.IKeyValuePair`2<")
402 .push_other(K::NAME)
403 .push_slice(b", ")
404 .push_other(V::NAME)
405 .push_slice(b">");
406}
407impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
408 IKeyValuePair<K, V>
409{
410 pub fn Key(&self) -> windows_core::Result<K> {
411 unsafe {
412 let mut result__ = core::mem::zeroed();
413 (windows_core::Interface::vtable(self).Key)(
414 windows_core::Interface::as_raw(self),
415 &mut result__,
416 )
417 .and_then(|| windows_core::imp::Type::from_abi(result__))
418 }
419 }
420 pub fn Value(&self) -> windows_core::Result<V> {
421 unsafe {
422 let mut result__ = core::mem::zeroed();
423 (windows_core::Interface::vtable(self).Value)(
424 windows_core::Interface::as_raw(self),
425 &mut result__,
426 )
427 .and_then(|| windows_core::imp::Type::from_abi(result__))
428 }
429 }
430}
431impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
432 windows_core::RuntimeName for IKeyValuePair<K, V>
433{
434 const NAME: &'static str = "Windows.Foundation.Collections.IKeyValuePair";
435 const RUNTIME_CLASS_NAME: windows_core::imp::ConstBuffer =
436 <Self as windows_core::RuntimeType>::NAME;
437}
438pub trait IKeyValuePair_Impl<K, V>: windows_core::IUnknownImpl
439where
440 K: windows_core::RuntimeType + 'static,
441 V: windows_core::RuntimeType + 'static,
442{
443 fn Key(&self) -> windows_core::Result<K>;
444 fn Value(&self) -> windows_core::Result<V>;
445}
446impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
447 IKeyValuePair_Vtbl<K, V>
448{
449 pub const fn new<Identity: IKeyValuePair_Impl<K, V>, const OFFSET: isize>() -> Self {
450 unsafe extern "system" fn Key<
451 K: windows_core::RuntimeType + 'static,
452 V: windows_core::RuntimeType + 'static,
453 Identity: IKeyValuePair_Impl<K, V>,
454 const OFFSET: isize,
455 >(
456 this: *mut core::ffi::c_void,
457 result__: *mut windows_core::imp::AbiType<K>,
458 ) -> windows_core::HRESULT {
459 unsafe {
460 let this: &Identity =
461 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
462 match IKeyValuePair_Impl::Key(this) {
463 Ok(ok__) => {
464 result__.write(core::mem::transmute_copy(&ok__));
465 core::mem::forget(ok__);
466 windows_core::HRESULT(0)
467 }
468 Err(err) => err.into(),
469 }
470 }
471 }
472 unsafe extern "system" fn Value<
473 K: windows_core::RuntimeType + 'static,
474 V: windows_core::RuntimeType + 'static,
475 Identity: IKeyValuePair_Impl<K, V>,
476 const OFFSET: isize,
477 >(
478 this: *mut core::ffi::c_void,
479 result__: *mut windows_core::imp::AbiType<V>,
480 ) -> windows_core::HRESULT {
481 unsafe {
482 let this: &Identity =
483 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
484 match IKeyValuePair_Impl::Value(this) {
485 Ok(ok__) => {
486 result__.write(core::mem::transmute_copy(&ok__));
487 core::mem::forget(ok__);
488 windows_core::HRESULT(0)
489 }
490 Err(err) => err.into(),
491 }
492 }
493 }
494 Self {
495 base__: windows_core::IInspectable_Vtbl::new::<Identity, IKeyValuePair<K, V>, OFFSET>(),
496 Key: Key::<K, V, Identity, OFFSET>,
497 Value: Value::<K, V, Identity, OFFSET>,
498 K: core::marker::PhantomData::<K>,
499 V: core::marker::PhantomData::<V>,
500 }
501 }
502 pub fn matches(iid: &windows_core::GUID) -> bool {
503 iid == &<IKeyValuePair<K, V> as windows_core::Interface>::IID
504 }
505}
506#[repr(C)]
507pub struct IKeyValuePair_Vtbl<K, V>
508where
509 K: windows_core::RuntimeType + 'static,
510 V: windows_core::RuntimeType + 'static,
511{
512 pub base__: windows_core::IInspectable_Vtbl,
513 pub Key: unsafe extern "system" fn(
514 *mut core::ffi::c_void,
515 *mut windows_core::imp::AbiType<K>,
516 ) -> windows_core::HRESULT,
517 pub Value: unsafe extern "system" fn(
518 *mut core::ffi::c_void,
519 *mut windows_core::imp::AbiType<V>,
520 ) -> windows_core::HRESULT,
521 K: core::marker::PhantomData<K>,
522 V: core::marker::PhantomData<V>,
523}
524#[repr(transparent)]
525#[derive(Clone, Debug, Eq, PartialEq)]
526pub struct IMap<K, V>(
527 windows_core::IUnknown,
528 core::marker::PhantomData<K>,
529 core::marker::PhantomData<V>,
530)
531where
532 K: windows_core::RuntimeType + 'static,
533 V: windows_core::RuntimeType + 'static;
534impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
535 windows_core::imp::CanInto<windows_core::IUnknown> for IMap<K, V>
536{
537}
538impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
539 windows_core::imp::CanInto<windows_core::IInspectable> for IMap<K, V>
540{
541}
542unsafe impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
543 windows_core::Interface for IMap<K, V>
544{
545 type Vtable = IMap_Vtbl<K, V>;
546 const IID: windows_core::GUID =
547 windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE);
548}
549impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
550 windows_core::RuntimeType for IMap<K, V>
551{
552 const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
553 .push_slice(b"pinterface({3c2925fe-8519-45c1-aa79-197b6718c1c1}")
554 .push_slice(b";")
555 .push_other(K::SIGNATURE)
556 .push_slice(b";")
557 .push_other(V::SIGNATURE)
558 .push_slice(b")");
559 const NAME: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
560 .push_slice(b"Windows.Foundation.Collections.IMap`2<")
561 .push_other(K::NAME)
562 .push_slice(b", ")
563 .push_other(V::NAME)
564 .push_slice(b">");
565}
566impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
567 windows_core::imp::CanInto<IIterable<IKeyValuePair<K, V>>> for IMap<K, V>
568{
569 const QUERY: bool = true;
570}
571impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> IMap<K, V> {
572 pub fn Lookup<P0>(&self, key: P0) -> windows_core::Result<V>
573 where
574 P0: windows_core::Param<K>,
575 {
576 unsafe {
577 let mut result__ = core::mem::zeroed();
578 (windows_core::Interface::vtable(self).Lookup)(
579 windows_core::Interface::as_raw(self),
580 key.param().abi(),
581 &mut result__,
582 )
583 .and_then(|| windows_core::imp::Type::from_abi(result__))
584 }
585 }
586 pub fn Size(&self) -> windows_core::Result<u32> {
587 unsafe {
588 let mut result__ = core::mem::zeroed();
589 (windows_core::Interface::vtable(self).Size)(
590 windows_core::Interface::as_raw(self),
591 &mut result__,
592 )
593 .map(|| result__)
594 }
595 }
596 pub fn HasKey<P0>(&self, key: P0) -> windows_core::Result<bool>
597 where
598 P0: windows_core::Param<K>,
599 {
600 unsafe {
601 let mut result__ = core::mem::zeroed();
602 (windows_core::Interface::vtable(self).HasKey)(
603 windows_core::Interface::as_raw(self),
604 key.param().abi(),
605 &mut result__,
606 )
607 .map(|| result__)
608 }
609 }
610 pub fn GetView(&self) -> windows_core::Result<IMapView<K, V>> {
611 unsafe {
612 let mut result__ = core::mem::zeroed();
613 (windows_core::Interface::vtable(self).GetView)(
614 windows_core::Interface::as_raw(self),
615 &mut result__,
616 )
617 .and_then(|| windows_core::imp::Type::from_abi(result__))
618 }
619 }
620 pub fn Insert<P0, P1>(&self, key: P0, value: P1) -> windows_core::Result<bool>
621 where
622 P0: windows_core::Param<K>,
623 P1: windows_core::Param<V>,
624 {
625 unsafe {
626 let mut result__ = core::mem::zeroed();
627 (windows_core::Interface::vtable(self).Insert)(
628 windows_core::Interface::as_raw(self),
629 key.param().abi(),
630 value.param().abi(),
631 &mut result__,
632 )
633 .map(|| result__)
634 }
635 }
636 pub fn Remove<P0>(&self, key: P0) -> windows_core::Result<()>
637 where
638 P0: windows_core::Param<K>,
639 {
640 unsafe {
641 (windows_core::Interface::vtable(self).Remove)(
642 windows_core::Interface::as_raw(self),
643 key.param().abi(),
644 )
645 .ok()
646 }
647 }
648 pub fn Clear(&self) -> windows_core::Result<()> {
649 unsafe {
650 (windows_core::Interface::vtable(self).Clear)(windows_core::Interface::as_raw(self))
651 .ok()
652 }
653 }
654 pub fn First(&self) -> windows_core::Result<IIterator<IKeyValuePair<K, V>>> {
655 let this = &windows_core::Interface::cast::<IIterable<IKeyValuePair<K, V>>>(self)?;
656 unsafe {
657 let mut result__ = core::mem::zeroed();
658 (windows_core::Interface::vtable(this).First)(
659 windows_core::Interface::as_raw(this),
660 &mut result__,
661 )
662 .and_then(|| windows_core::imp::Type::from_abi(result__))
663 }
664 }
665}
666impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> IntoIterator
667 for IMap<K, V>
668{
669 type Item = IKeyValuePair<K, V>;
670 type IntoIter = windows_collections::BufferedIterator<Self::Item>;
671 fn into_iter(self) -> Self::IntoIter {
672 IntoIterator::into_iter(&self)
673 }
674}
675impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> IntoIterator
676 for &IMap<K, V>
677{
678 type Item = IKeyValuePair<K, V>;
679 type IntoIter = windows_collections::BufferedIterator<Self::Item>;
680 fn into_iter(self) -> Self::IntoIter {
681 windows_collections::BufferedIterator::new(self.First().unwrap())
682 }
683}
684impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
685 windows_core::RuntimeName for IMap<K, V>
686{
687 const NAME: &'static str = "Windows.Foundation.Collections.IMap";
688 const RUNTIME_CLASS_NAME: windows_core::imp::ConstBuffer =
689 <Self as windows_core::RuntimeType>::NAME;
690}
691pub trait IMap_Impl<K, V>: IIterable_Impl<IKeyValuePair<K, V>>
692where
693 K: windows_core::RuntimeType + 'static,
694 V: windows_core::RuntimeType + 'static,
695{
696 fn Lookup(&self, key: windows_core::Ref<K>) -> windows_core::Result<V>;
697 fn Size(&self) -> windows_core::Result<u32>;
698 fn HasKey(&self, key: windows_core::Ref<K>) -> windows_core::Result<bool>;
699 fn GetView(&self) -> windows_core::Result<IMapView<K, V>>;
700 fn Insert(
701 &self,
702 key: windows_core::Ref<K>,
703 value: windows_core::Ref<V>,
704 ) -> windows_core::Result<bool>;
705 fn Remove(&self, key: windows_core::Ref<K>) -> windows_core::Result<()>;
706 fn Clear(&self) -> windows_core::Result<()>;
707}
708impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
709 IMap_Vtbl<K, V>
710{
711 pub const fn new<Identity: IMap_Impl<K, V>, const OFFSET: isize>() -> Self {
712 unsafe extern "system" fn Lookup<
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 key: windows_core::imp::AbiType<K>,
720 result__: *mut windows_core::imp::AbiType<V>,
721 ) -> windows_core::HRESULT {
722 unsafe {
723 let this: &Identity =
724 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
725 match IMap_Impl::Lookup(this, core::mem::transmute_copy(&key)) {
726 Ok(ok__) => {
727 result__.write(core::mem::transmute_copy(&ok__));
728 core::mem::forget(ok__);
729 windows_core::HRESULT(0)
730 }
731 Err(err) => err.into(),
732 }
733 }
734 }
735 unsafe extern "system" fn Size<
736 K: windows_core::RuntimeType + 'static,
737 V: windows_core::RuntimeType + 'static,
738 Identity: IMap_Impl<K, V>,
739 const OFFSET: isize,
740 >(
741 this: *mut core::ffi::c_void,
742 result__: *mut u32,
743 ) -> windows_core::HRESULT {
744 unsafe {
745 let this: &Identity =
746 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
747 match IMap_Impl::Size(this) {
748 Ok(ok__) => {
749 result__.write(ok__);
750 windows_core::HRESULT(0)
751 }
752 Err(err) => err.into(),
753 }
754 }
755 }
756 unsafe extern "system" fn HasKey<
757 K: windows_core::RuntimeType + 'static,
758 V: windows_core::RuntimeType + 'static,
759 Identity: IMap_Impl<K, V>,
760 const OFFSET: isize,
761 >(
762 this: *mut core::ffi::c_void,
763 key: windows_core::imp::AbiType<K>,
764 result__: *mut bool,
765 ) -> windows_core::HRESULT {
766 unsafe {
767 let this: &Identity =
768 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
769 match IMap_Impl::HasKey(this, core::mem::transmute_copy(&key)) {
770 Ok(ok__) => {
771 result__.write(ok__);
772 windows_core::HRESULT(0)
773 }
774 Err(err) => err.into(),
775 }
776 }
777 }
778 unsafe extern "system" fn GetView<
779 K: windows_core::RuntimeType + 'static,
780 V: windows_core::RuntimeType + 'static,
781 Identity: IMap_Impl<K, V>,
782 const OFFSET: isize,
783 >(
784 this: *mut core::ffi::c_void,
785 result__: *mut *mut core::ffi::c_void,
786 ) -> windows_core::HRESULT {
787 unsafe {
788 let this: &Identity =
789 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
790 match IMap_Impl::GetView(this) {
791 Ok(ok__) => {
792 result__.write(core::mem::transmute_copy(&ok__));
793 core::mem::forget(ok__);
794 windows_core::HRESULT(0)
795 }
796 Err(err) => err.into(),
797 }
798 }
799 }
800 unsafe extern "system" fn Insert<
801 K: windows_core::RuntimeType + 'static,
802 V: windows_core::RuntimeType + 'static,
803 Identity: IMap_Impl<K, V>,
804 const OFFSET: isize,
805 >(
806 this: *mut core::ffi::c_void,
807 key: windows_core::imp::AbiType<K>,
808 value: windows_core::imp::AbiType<V>,
809 result__: *mut bool,
810 ) -> windows_core::HRESULT {
811 unsafe {
812 let this: &Identity =
813 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
814 match IMap_Impl::Insert(
815 this,
816 core::mem::transmute_copy(&key),
817 core::mem::transmute_copy(&value),
818 ) {
819 Ok(ok__) => {
820 result__.write(ok__);
821 windows_core::HRESULT(0)
822 }
823 Err(err) => err.into(),
824 }
825 }
826 }
827 unsafe extern "system" fn Remove<
828 K: windows_core::RuntimeType + 'static,
829 V: windows_core::RuntimeType + 'static,
830 Identity: IMap_Impl<K, V>,
831 const OFFSET: isize,
832 >(
833 this: *mut core::ffi::c_void,
834 key: windows_core::imp::AbiType<K>,
835 ) -> windows_core::HRESULT {
836 unsafe {
837 let this: &Identity =
838 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
839 IMap_Impl::Remove(this, core::mem::transmute_copy(&key)).into()
840 }
841 }
842 unsafe extern "system" fn Clear<
843 K: windows_core::RuntimeType + 'static,
844 V: windows_core::RuntimeType + 'static,
845 Identity: IMap_Impl<K, V>,
846 const OFFSET: isize,
847 >(
848 this: *mut core::ffi::c_void,
849 ) -> windows_core::HRESULT {
850 unsafe {
851 let this: &Identity =
852 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
853 IMap_Impl::Clear(this).into()
854 }
855 }
856 Self {
857 base__: windows_core::IInspectable_Vtbl::new::<Identity, IMap<K, V>, OFFSET>(),
858 Lookup: Lookup::<K, V, Identity, OFFSET>,
859 Size: Size::<K, V, Identity, OFFSET>,
860 HasKey: HasKey::<K, V, Identity, OFFSET>,
861 GetView: GetView::<K, V, Identity, OFFSET>,
862 Insert: Insert::<K, V, Identity, OFFSET>,
863 Remove: Remove::<K, V, Identity, OFFSET>,
864 Clear: Clear::<K, V, Identity, OFFSET>,
865 K: core::marker::PhantomData::<K>,
866 V: core::marker::PhantomData::<V>,
867 }
868 }
869 pub fn matches(iid: &windows_core::GUID) -> bool {
870 iid == &<IMap<K, V> as windows_core::Interface>::IID
871 }
872}
873#[repr(C)]
874pub struct IMap_Vtbl<K, V>
875where
876 K: windows_core::RuntimeType + 'static,
877 V: windows_core::RuntimeType + 'static,
878{
879 pub base__: windows_core::IInspectable_Vtbl,
880 pub Lookup: unsafe extern "system" fn(
881 *mut core::ffi::c_void,
882 windows_core::imp::AbiType<K>,
883 *mut windows_core::imp::AbiType<V>,
884 ) -> windows_core::HRESULT,
885 pub Size: unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> windows_core::HRESULT,
886 pub HasKey: unsafe extern "system" fn(
887 *mut core::ffi::c_void,
888 windows_core::imp::AbiType<K>,
889 *mut bool,
890 ) -> windows_core::HRESULT,
891 pub GetView: unsafe extern "system" fn(
892 *mut core::ffi::c_void,
893 *mut *mut core::ffi::c_void,
894 ) -> windows_core::HRESULT,
895 pub Insert: unsafe extern "system" fn(
896 *mut core::ffi::c_void,
897 windows_core::imp::AbiType<K>,
898 windows_core::imp::AbiType<V>,
899 *mut bool,
900 ) -> windows_core::HRESULT,
901 pub Remove: unsafe extern "system" fn(
902 *mut core::ffi::c_void,
903 windows_core::imp::AbiType<K>,
904 ) -> windows_core::HRESULT,
905 pub Clear: unsafe extern "system" fn(*mut core::ffi::c_void) -> windows_core::HRESULT,
906 K: core::marker::PhantomData<K>,
907 V: core::marker::PhantomData<V>,
908}
909#[repr(transparent)]
910#[derive(Clone, Debug, Eq, PartialEq)]
911pub struct IMapChangedEventArgs<K>(windows_core::IUnknown, core::marker::PhantomData<K>)
912where
913 K: windows_core::RuntimeType + 'static;
914impl<K: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IUnknown>
915 for IMapChangedEventArgs<K>
916{
917}
918impl<K: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IInspectable>
919 for IMapChangedEventArgs<K>
920{
921}
922unsafe impl<K: windows_core::RuntimeType + 'static> windows_core::Interface
923 for IMapChangedEventArgs<K>
924{
925 type Vtable = IMapChangedEventArgs_Vtbl<K>;
926 const IID: windows_core::GUID =
927 windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE);
928}
929impl<K: windows_core::RuntimeType + 'static> windows_core::RuntimeType for IMapChangedEventArgs<K> {
930 const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
931 .push_slice(b"pinterface({9939f4df-050a-4c0f-aa60-77075f9c4777}")
932 .push_slice(b";")
933 .push_other(K::SIGNATURE)
934 .push_slice(b")");
935 const NAME: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
936 .push_slice(b"Windows.Foundation.Collections.IMapChangedEventArgs`1<")
937 .push_other(K::NAME)
938 .push_slice(b">");
939}
940impl<K: windows_core::RuntimeType + 'static> IMapChangedEventArgs<K> {
941 pub fn CollectionChange(&self) -> windows_core::Result<CollectionChange> {
942 unsafe {
943 let mut result__ = core::mem::zeroed();
944 (windows_core::Interface::vtable(self).CollectionChange)(
945 windows_core::Interface::as_raw(self),
946 &mut result__,
947 )
948 .map(|| result__)
949 }
950 }
951 pub fn Key(&self) -> windows_core::Result<K> {
952 unsafe {
953 let mut result__ = core::mem::zeroed();
954 (windows_core::Interface::vtable(self).Key)(
955 windows_core::Interface::as_raw(self),
956 &mut result__,
957 )
958 .and_then(|| windows_core::imp::Type::from_abi(result__))
959 }
960 }
961}
962impl<K: windows_core::RuntimeType + 'static> windows_core::RuntimeName for IMapChangedEventArgs<K> {
963 const NAME: &'static str = "Windows.Foundation.Collections.IMapChangedEventArgs";
964 const RUNTIME_CLASS_NAME: windows_core::imp::ConstBuffer =
965 <Self as windows_core::RuntimeType>::NAME;
966}
967pub trait IMapChangedEventArgs_Impl<K>: windows_core::IUnknownImpl
968where
969 K: windows_core::RuntimeType + 'static,
970{
971 fn CollectionChange(&self) -> windows_core::Result<CollectionChange>;
972 fn Key(&self) -> windows_core::Result<K>;
973}
974impl<K: windows_core::RuntimeType + 'static> IMapChangedEventArgs_Vtbl<K> {
975 pub const fn new<Identity: IMapChangedEventArgs_Impl<K>, const OFFSET: isize>() -> Self {
976 unsafe extern "system" fn CollectionChange<
977 K: windows_core::RuntimeType + 'static,
978 Identity: IMapChangedEventArgs_Impl<K>,
979 const OFFSET: isize,
980 >(
981 this: *mut core::ffi::c_void,
982 result__: *mut CollectionChange,
983 ) -> windows_core::HRESULT {
984 unsafe {
985 let this: &Identity =
986 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
987 match IMapChangedEventArgs_Impl::CollectionChange(this) {
988 Ok(ok__) => {
989 result__.write(ok__);
990 windows_core::HRESULT(0)
991 }
992 Err(err) => err.into(),
993 }
994 }
995 }
996 unsafe extern "system" fn Key<
997 K: windows_core::RuntimeType + 'static,
998 Identity: IMapChangedEventArgs_Impl<K>,
999 const OFFSET: isize,
1000 >(
1001 this: *mut core::ffi::c_void,
1002 result__: *mut windows_core::imp::AbiType<K>,
1003 ) -> windows_core::HRESULT {
1004 unsafe {
1005 let this: &Identity =
1006 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
1007 match IMapChangedEventArgs_Impl::Key(this) {
1008 Ok(ok__) => {
1009 result__.write(core::mem::transmute_copy(&ok__));
1010 core::mem::forget(ok__);
1011 windows_core::HRESULT(0)
1012 }
1013 Err(err) => err.into(),
1014 }
1015 }
1016 }
1017 Self {
1018 base__: windows_core::IInspectable_Vtbl::new::<Identity, IMapChangedEventArgs<K>, OFFSET>(
1019 ),
1020 CollectionChange: CollectionChange::<K, Identity, OFFSET>,
1021 Key: Key::<K, Identity, OFFSET>,
1022 K: core::marker::PhantomData::<K>,
1023 }
1024 }
1025 pub fn matches(iid: &windows_core::GUID) -> bool {
1026 iid == &<IMapChangedEventArgs<K> as windows_core::Interface>::IID
1027 }
1028}
1029#[repr(C)]
1030pub struct IMapChangedEventArgs_Vtbl<K>
1031where
1032 K: windows_core::RuntimeType + 'static,
1033{
1034 pub base__: windows_core::IInspectable_Vtbl,
1035 pub CollectionChange: unsafe extern "system" fn(
1036 *mut core::ffi::c_void,
1037 *mut CollectionChange,
1038 ) -> windows_core::HRESULT,
1039 pub Key: unsafe extern "system" fn(
1040 *mut core::ffi::c_void,
1041 *mut windows_core::imp::AbiType<K>,
1042 ) -> windows_core::HRESULT,
1043 K: core::marker::PhantomData<K>,
1044}
1045#[repr(transparent)]
1046#[derive(Clone, Debug, Eq, PartialEq)]
1047pub struct IMapView<K, V>(
1048 windows_core::IUnknown,
1049 core::marker::PhantomData<K>,
1050 core::marker::PhantomData<V>,
1051)
1052where
1053 K: windows_core::RuntimeType + 'static,
1054 V: windows_core::RuntimeType + 'static;
1055impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1056 windows_core::imp::CanInto<windows_core::IUnknown> for IMapView<K, V>
1057{
1058}
1059impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1060 windows_core::imp::CanInto<windows_core::IInspectable> for IMapView<K, V>
1061{
1062}
1063unsafe impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1064 windows_core::Interface for IMapView<K, V>
1065{
1066 type Vtable = IMapView_Vtbl<K, V>;
1067 const IID: windows_core::GUID =
1068 windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE);
1069}
1070impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1071 windows_core::RuntimeType for IMapView<K, V>
1072{
1073 const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
1074 .push_slice(b"pinterface({e480ce40-a338-4ada-adcf-272272e48cb9}")
1075 .push_slice(b";")
1076 .push_other(K::SIGNATURE)
1077 .push_slice(b";")
1078 .push_other(V::SIGNATURE)
1079 .push_slice(b")");
1080 const NAME: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
1081 .push_slice(b"Windows.Foundation.Collections.IMapView`2<")
1082 .push_other(K::NAME)
1083 .push_slice(b", ")
1084 .push_other(V::NAME)
1085 .push_slice(b">");
1086}
1087impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1088 windows_core::imp::CanInto<IIterable<IKeyValuePair<K, V>>> for IMapView<K, V>
1089{
1090 const QUERY: bool = true;
1091}
1092impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1093 IMapView<K, V>
1094{
1095 pub fn Lookup<P0>(&self, key: P0) -> windows_core::Result<V>
1096 where
1097 P0: windows_core::Param<K>,
1098 {
1099 unsafe {
1100 let mut result__ = core::mem::zeroed();
1101 (windows_core::Interface::vtable(self).Lookup)(
1102 windows_core::Interface::as_raw(self),
1103 key.param().abi(),
1104 &mut result__,
1105 )
1106 .and_then(|| windows_core::imp::Type::from_abi(result__))
1107 }
1108 }
1109 pub fn Size(&self) -> windows_core::Result<u32> {
1110 unsafe {
1111 let mut result__ = core::mem::zeroed();
1112 (windows_core::Interface::vtable(self).Size)(
1113 windows_core::Interface::as_raw(self),
1114 &mut result__,
1115 )
1116 .map(|| result__)
1117 }
1118 }
1119 pub fn HasKey<P0>(&self, key: P0) -> windows_core::Result<bool>
1120 where
1121 P0: windows_core::Param<K>,
1122 {
1123 unsafe {
1124 let mut result__ = core::mem::zeroed();
1125 (windows_core::Interface::vtable(self).HasKey)(
1126 windows_core::Interface::as_raw(self),
1127 key.param().abi(),
1128 &mut result__,
1129 )
1130 .map(|| result__)
1131 }
1132 }
1133 pub fn Split(
1134 &self,
1135 first: &mut Option<Self>,
1136 second: &mut Option<Self>,
1137 ) -> windows_core::Result<()> {
1138 unsafe {
1139 (windows_core::Interface::vtable(self).Split)(
1140 windows_core::Interface::as_raw(self),
1141 first as *mut _ as _,
1142 second as *mut _ as _,
1143 )
1144 .ok()
1145 }
1146 }
1147 pub fn First(&self) -> windows_core::Result<IIterator<IKeyValuePair<K, V>>> {
1148 let this = &windows_core::Interface::cast::<IIterable<IKeyValuePair<K, V>>>(self)?;
1149 unsafe {
1150 let mut result__ = core::mem::zeroed();
1151 (windows_core::Interface::vtable(this).First)(
1152 windows_core::Interface::as_raw(this),
1153 &mut result__,
1154 )
1155 .and_then(|| windows_core::imp::Type::from_abi(result__))
1156 }
1157 }
1158}
1159impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> IntoIterator
1160 for IMapView<K, V>
1161{
1162 type Item = IKeyValuePair<K, V>;
1163 type IntoIter = windows_collections::BufferedIterator<Self::Item>;
1164 fn into_iter(self) -> Self::IntoIter {
1165 IntoIterator::into_iter(&self)
1166 }
1167}
1168impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> IntoIterator
1169 for &IMapView<K, V>
1170{
1171 type Item = IKeyValuePair<K, V>;
1172 type IntoIter = windows_collections::BufferedIterator<Self::Item>;
1173 fn into_iter(self) -> Self::IntoIter {
1174 windows_collections::BufferedIterator::new(self.First().unwrap())
1175 }
1176}
1177impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1178 windows_core::RuntimeName for IMapView<K, V>
1179{
1180 const NAME: &'static str = "Windows.Foundation.Collections.IMapView";
1181 const RUNTIME_CLASS_NAME: windows_core::imp::ConstBuffer =
1182 <Self as windows_core::RuntimeType>::NAME;
1183}
1184pub trait IMapView_Impl<K, V>: IIterable_Impl<IKeyValuePair<K, V>>
1185where
1186 K: windows_core::RuntimeType + 'static,
1187 V: windows_core::RuntimeType + 'static,
1188{
1189 fn Lookup(&self, key: windows_core::Ref<K>) -> windows_core::Result<V>;
1190 fn Size(&self) -> windows_core::Result<u32>;
1191 fn HasKey(&self, key: windows_core::Ref<K>) -> windows_core::Result<bool>;
1192 fn Split(
1193 &self,
1194 first: windows_core::OutRef<IMapView<K, V>>,
1195 second: windows_core::OutRef<IMapView<K, V>>,
1196 ) -> windows_core::Result<()>;
1197}
1198impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1199 IMapView_Vtbl<K, V>
1200{
1201 pub const fn new<Identity: IMapView_Impl<K, V>, const OFFSET: isize>() -> Self {
1202 unsafe extern "system" fn Lookup<
1203 K: windows_core::RuntimeType + 'static,
1204 V: windows_core::RuntimeType + 'static,
1205 Identity: IMapView_Impl<K, V>,
1206 const OFFSET: isize,
1207 >(
1208 this: *mut core::ffi::c_void,
1209 key: windows_core::imp::AbiType<K>,
1210 result__: *mut windows_core::imp::AbiType<V>,
1211 ) -> windows_core::HRESULT {
1212 unsafe {
1213 let this: &Identity =
1214 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
1215 match IMapView_Impl::Lookup(this, core::mem::transmute_copy(&key)) {
1216 Ok(ok__) => {
1217 result__.write(core::mem::transmute_copy(&ok__));
1218 core::mem::forget(ok__);
1219 windows_core::HRESULT(0)
1220 }
1221 Err(err) => err.into(),
1222 }
1223 }
1224 }
1225 unsafe extern "system" fn Size<
1226 K: windows_core::RuntimeType + 'static,
1227 V: windows_core::RuntimeType + 'static,
1228 Identity: IMapView_Impl<K, V>,
1229 const OFFSET: isize,
1230 >(
1231 this: *mut core::ffi::c_void,
1232 result__: *mut u32,
1233 ) -> windows_core::HRESULT {
1234 unsafe {
1235 let this: &Identity =
1236 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
1237 match IMapView_Impl::Size(this) {
1238 Ok(ok__) => {
1239 result__.write(ok__);
1240 windows_core::HRESULT(0)
1241 }
1242 Err(err) => err.into(),
1243 }
1244 }
1245 }
1246 unsafe extern "system" fn HasKey<
1247 K: windows_core::RuntimeType + 'static,
1248 V: windows_core::RuntimeType + 'static,
1249 Identity: IMapView_Impl<K, V>,
1250 const OFFSET: isize,
1251 >(
1252 this: *mut core::ffi::c_void,
1253 key: windows_core::imp::AbiType<K>,
1254 result__: *mut bool,
1255 ) -> windows_core::HRESULT {
1256 unsafe {
1257 let this: &Identity =
1258 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
1259 match IMapView_Impl::HasKey(this, core::mem::transmute_copy(&key)) {
1260 Ok(ok__) => {
1261 result__.write(ok__);
1262 windows_core::HRESULT(0)
1263 }
1264 Err(err) => err.into(),
1265 }
1266 }
1267 }
1268 unsafe extern "system" fn Split<
1269 K: windows_core::RuntimeType + 'static,
1270 V: windows_core::RuntimeType + 'static,
1271 Identity: IMapView_Impl<K, V>,
1272 const OFFSET: isize,
1273 >(
1274 this: *mut core::ffi::c_void,
1275 first: *mut *mut core::ffi::c_void,
1276 second: *mut *mut core::ffi::c_void,
1277 ) -> windows_core::HRESULT {
1278 unsafe {
1279 let this: &Identity =
1280 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
1281 IMapView_Impl::Split(
1282 this,
1283 core::mem::transmute_copy(&first),
1284 core::mem::transmute_copy(&second),
1285 )
1286 .into()
1287 }
1288 }
1289 Self {
1290 base__: windows_core::IInspectable_Vtbl::new::<Identity, IMapView<K, V>, OFFSET>(),
1291 Lookup: Lookup::<K, V, Identity, OFFSET>,
1292 Size: Size::<K, V, Identity, OFFSET>,
1293 HasKey: HasKey::<K, V, Identity, OFFSET>,
1294 Split: Split::<K, V, Identity, OFFSET>,
1295 K: core::marker::PhantomData::<K>,
1296 V: core::marker::PhantomData::<V>,
1297 }
1298 }
1299 pub fn matches(iid: &windows_core::GUID) -> bool {
1300 iid == &<IMapView<K, V> as windows_core::Interface>::IID
1301 }
1302}
1303#[repr(C)]
1304pub struct IMapView_Vtbl<K, V>
1305where
1306 K: windows_core::RuntimeType + 'static,
1307 V: windows_core::RuntimeType + 'static,
1308{
1309 pub base__: windows_core::IInspectable_Vtbl,
1310 pub Lookup: unsafe extern "system" fn(
1311 *mut core::ffi::c_void,
1312 windows_core::imp::AbiType<K>,
1313 *mut windows_core::imp::AbiType<V>,
1314 ) -> windows_core::HRESULT,
1315 pub Size: unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> windows_core::HRESULT,
1316 pub HasKey: unsafe extern "system" fn(
1317 *mut core::ffi::c_void,
1318 windows_core::imp::AbiType<K>,
1319 *mut bool,
1320 ) -> windows_core::HRESULT,
1321 pub Split: unsafe extern "system" fn(
1322 *mut core::ffi::c_void,
1323 *mut *mut core::ffi::c_void,
1324 *mut *mut core::ffi::c_void,
1325 ) -> windows_core::HRESULT,
1326 K: core::marker::PhantomData<K>,
1327 V: core::marker::PhantomData<V>,
1328}
1329#[repr(transparent)]
1330#[derive(Clone, Debug, Eq, PartialEq)]
1331pub struct IObservableMap<K, V>(
1332 windows_core::IUnknown,
1333 core::marker::PhantomData<K>,
1334 core::marker::PhantomData<V>,
1335)
1336where
1337 K: windows_core::RuntimeType + 'static,
1338 V: windows_core::RuntimeType + 'static;
1339impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1340 windows_core::imp::CanInto<windows_core::IUnknown> for IObservableMap<K, V>
1341{
1342}
1343impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1344 windows_core::imp::CanInto<windows_core::IInspectable> for IObservableMap<K, V>
1345{
1346}
1347unsafe impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1348 windows_core::Interface for IObservableMap<K, V>
1349{
1350 type Vtable = IObservableMap_Vtbl<K, V>;
1351 const IID: windows_core::GUID =
1352 windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE);
1353}
1354impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1355 windows_core::RuntimeType for IObservableMap<K, V>
1356{
1357 const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
1358 .push_slice(b"pinterface({65df2bf5-bf39-41b5-aebc-5a9d865e472b}")
1359 .push_slice(b";")
1360 .push_other(K::SIGNATURE)
1361 .push_slice(b";")
1362 .push_other(V::SIGNATURE)
1363 .push_slice(b")");
1364 const NAME: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
1365 .push_slice(b"Windows.Foundation.Collections.IObservableMap`2<")
1366 .push_other(K::NAME)
1367 .push_slice(b", ")
1368 .push_other(V::NAME)
1369 .push_slice(b">");
1370}
1371impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1372 windows_core::imp::CanInto<IIterable<IKeyValuePair<K, V>>> for IObservableMap<K, V>
1373{
1374 const QUERY: bool = true;
1375}
1376impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1377 windows_core::imp::CanInto<IMap<K, V>> for IObservableMap<K, V>
1378{
1379 const QUERY: bool = true;
1380}
1381impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1382 IObservableMap<K, V>
1383{
1384 pub fn MapChanged<F>(&self, handler: F) -> windows_core::Result<windows_core::EventRevoker>
1385 where
1386 F: Fn(windows_core::Ref<Self>, windows_core::Ref<IMapChangedEventArgs<K>>) + Send + 'static,
1387 {
1388 let handler = <MapChangedEventHandler<K, V>>::new(move |a0, a1| {
1389 handler(a0, a1);
1390 Ok(())
1391 });
1392 unsafe {
1393 let mut result__ = core::mem::zeroed();
1394 let token__ = (windows_core::Interface::vtable(self).MapChanged)(
1395 windows_core::Interface::as_raw(self),
1396 windows_core::Interface::as_raw(&handler),
1397 &mut result__,
1398 )
1399 .map(|| result__)?;
1400 Ok(windows_core::EventRevoker::new(
1401 self.clone(),
1402 token__,
1403 windows_core::Interface::vtable(self).RemoveMapChanged,
1404 ))
1405 }
1406 }
1407 pub fn First(&self) -> windows_core::Result<IIterator<IKeyValuePair<K, V>>> {
1408 let this = &windows_core::Interface::cast::<IIterable<IKeyValuePair<K, V>>>(self)?;
1409 unsafe {
1410 let mut result__ = core::mem::zeroed();
1411 (windows_core::Interface::vtable(this).First)(
1412 windows_core::Interface::as_raw(this),
1413 &mut result__,
1414 )
1415 .and_then(|| windows_core::imp::Type::from_abi(result__))
1416 }
1417 }
1418 pub fn Lookup<P0>(&self, key: P0) -> windows_core::Result<V>
1419 where
1420 P0: windows_core::Param<K>,
1421 {
1422 let this = &windows_core::Interface::cast::<IMap<K, V>>(self)?;
1423 unsafe {
1424 let mut result__ = core::mem::zeroed();
1425 (windows_core::Interface::vtable(this).Lookup)(
1426 windows_core::Interface::as_raw(this),
1427 key.param().abi(),
1428 &mut result__,
1429 )
1430 .and_then(|| windows_core::imp::Type::from_abi(result__))
1431 }
1432 }
1433 pub fn Size(&self) -> windows_core::Result<u32> {
1434 let this = &windows_core::Interface::cast::<IMap<K, V>>(self)?;
1435 unsafe {
1436 let mut result__ = core::mem::zeroed();
1437 (windows_core::Interface::vtable(this).Size)(
1438 windows_core::Interface::as_raw(this),
1439 &mut result__,
1440 )
1441 .map(|| result__)
1442 }
1443 }
1444 pub fn HasKey<P0>(&self, key: P0) -> windows_core::Result<bool>
1445 where
1446 P0: windows_core::Param<K>,
1447 {
1448 let this = &windows_core::Interface::cast::<IMap<K, V>>(self)?;
1449 unsafe {
1450 let mut result__ = core::mem::zeroed();
1451 (windows_core::Interface::vtable(this).HasKey)(
1452 windows_core::Interface::as_raw(this),
1453 key.param().abi(),
1454 &mut result__,
1455 )
1456 .map(|| result__)
1457 }
1458 }
1459 pub fn GetView(&self) -> windows_core::Result<IMapView<K, V>> {
1460 let this = &windows_core::Interface::cast::<IMap<K, V>>(self)?;
1461 unsafe {
1462 let mut result__ = core::mem::zeroed();
1463 (windows_core::Interface::vtable(this).GetView)(
1464 windows_core::Interface::as_raw(this),
1465 &mut result__,
1466 )
1467 .and_then(|| windows_core::imp::Type::from_abi(result__))
1468 }
1469 }
1470 pub fn Insert<P0, P1>(&self, key: P0, value: P1) -> windows_core::Result<bool>
1471 where
1472 P0: windows_core::Param<K>,
1473 P1: windows_core::Param<V>,
1474 {
1475 let this = &windows_core::Interface::cast::<IMap<K, V>>(self)?;
1476 unsafe {
1477 let mut result__ = core::mem::zeroed();
1478 (windows_core::Interface::vtable(this).Insert)(
1479 windows_core::Interface::as_raw(this),
1480 key.param().abi(),
1481 value.param().abi(),
1482 &mut result__,
1483 )
1484 .map(|| result__)
1485 }
1486 }
1487 pub fn Remove<P0>(&self, key: P0) -> windows_core::Result<()>
1488 where
1489 P0: windows_core::Param<K>,
1490 {
1491 let this = &windows_core::Interface::cast::<IMap<K, V>>(self)?;
1492 unsafe {
1493 (windows_core::Interface::vtable(this).Remove)(
1494 windows_core::Interface::as_raw(this),
1495 key.param().abi(),
1496 )
1497 .ok()
1498 }
1499 }
1500 pub fn Clear(&self) -> windows_core::Result<()> {
1501 let this = &windows_core::Interface::cast::<IMap<K, V>>(self)?;
1502 unsafe {
1503 (windows_core::Interface::vtable(this).Clear)(windows_core::Interface::as_raw(this))
1504 .ok()
1505 }
1506 }
1507}
1508impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> IntoIterator
1509 for IObservableMap<K, V>
1510{
1511 type Item = IKeyValuePair<K, V>;
1512 type IntoIter = windows_collections::BufferedIterator<Self::Item>;
1513 fn into_iter(self) -> Self::IntoIter {
1514 IntoIterator::into_iter(&self)
1515 }
1516}
1517impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static> IntoIterator
1518 for &IObservableMap<K, V>
1519{
1520 type Item = IKeyValuePair<K, V>;
1521 type IntoIter = windows_collections::BufferedIterator<Self::Item>;
1522 fn into_iter(self) -> Self::IntoIter {
1523 windows_collections::BufferedIterator::new(self.First().unwrap())
1524 }
1525}
1526impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1527 windows_core::RuntimeName for IObservableMap<K, V>
1528{
1529 const NAME: &'static str = "Windows.Foundation.Collections.IObservableMap";
1530 const RUNTIME_CLASS_NAME: windows_core::imp::ConstBuffer =
1531 <Self as windows_core::RuntimeType>::NAME;
1532}
1533pub trait IObservableMap_Impl<K, V>: IIterable_Impl<IKeyValuePair<K, V>> + IMap_Impl<K, V>
1534where
1535 K: windows_core::RuntimeType + 'static,
1536 V: windows_core::RuntimeType + 'static,
1537{
1538 fn MapChanged(
1539 &self,
1540 handler: windows_core::Ref<MapChangedEventHandler<K, V>>,
1541 ) -> windows_core::Result<i64>;
1542 fn RemoveMapChanged(&self, token: i64) -> windows_core::Result<()>;
1543}
1544impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
1545 IObservableMap_Vtbl<K, V>
1546{
1547 pub const fn new<Identity: IObservableMap_Impl<K, V>, const OFFSET: isize>() -> Self {
1548 unsafe extern "system" fn MapChanged<
1549 K: windows_core::RuntimeType + 'static,
1550 V: windows_core::RuntimeType + 'static,
1551 Identity: IObservableMap_Impl<K, V>,
1552 const OFFSET: isize,
1553 >(
1554 this: *mut core::ffi::c_void,
1555 handler: *mut core::ffi::c_void,
1556 result__: *mut i64,
1557 ) -> windows_core::HRESULT {
1558 unsafe {
1559 let this: &Identity =
1560 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
1561 match IObservableMap_Impl::MapChanged(this, core::mem::transmute_copy(&handler)) {
1562 Ok(ok__) => {
1563 result__.write(ok__);
1564 windows_core::HRESULT(0)
1565 }
1566 Err(err) => err.into(),
1567 }
1568 }
1569 }
1570 unsafe extern "system" fn RemoveMapChanged<
1571 K: windows_core::RuntimeType + 'static,
1572 V: windows_core::RuntimeType + 'static,
1573 Identity: IObservableMap_Impl<K, V>,
1574 const OFFSET: isize,
1575 >(
1576 this: *mut core::ffi::c_void,
1577 token: i64,
1578 ) -> windows_core::HRESULT {
1579 unsafe {
1580 let this: &Identity =
1581 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
1582 IObservableMap_Impl::RemoveMapChanged(this, token).into()
1583 }
1584 }
1585 Self {
1586 base__: windows_core::IInspectable_Vtbl::new::<Identity, IObservableMap<K, V>, OFFSET>(
1587 ),
1588 MapChanged: MapChanged::<K, V, Identity, OFFSET>,
1589 RemoveMapChanged: RemoveMapChanged::<K, V, Identity, OFFSET>,
1590 K: core::marker::PhantomData::<K>,
1591 V: core::marker::PhantomData::<V>,
1592 }
1593 }
1594 pub fn matches(iid: &windows_core::GUID) -> bool {
1595 iid == &<IObservableMap<K, V> as windows_core::Interface>::IID
1596 }
1597}
1598#[repr(C)]
1599pub struct IObservableMap_Vtbl<K, V>
1600where
1601 K: windows_core::RuntimeType + 'static,
1602 V: windows_core::RuntimeType + 'static,
1603{
1604 pub base__: windows_core::IInspectable_Vtbl,
1605 pub MapChanged: unsafe extern "system" fn(
1606 *mut core::ffi::c_void,
1607 *mut core::ffi::c_void,
1608 *mut i64,
1609 ) -> windows_core::HRESULT,
1610 pub RemoveMapChanged:
1611 unsafe extern "system" fn(*mut core::ffi::c_void, i64) -> windows_core::HRESULT,
1612 K: core::marker::PhantomData<K>,
1613 V: core::marker::PhantomData<V>,
1614}
1615#[repr(transparent)]
1616#[derive(Clone, Debug, Eq, PartialEq)]
1617pub struct IObservableVector<T>(windows_core::IUnknown, core::marker::PhantomData<T>)
1618where
1619 T: windows_core::RuntimeType + 'static;
1620impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IUnknown>
1621 for IObservableVector<T>
1622{
1623}
1624impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IInspectable>
1625 for IObservableVector<T>
1626{
1627}
1628unsafe impl<T: windows_core::RuntimeType + 'static> windows_core::Interface
1629 for IObservableVector<T>
1630{
1631 type Vtable = IObservableVector_Vtbl<T>;
1632 const IID: windows_core::GUID =
1633 windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE);
1634}
1635impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeType for IObservableVector<T> {
1636 const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
1637 .push_slice(b"pinterface({5917eb53-50b4-4a0d-b309-65862b3f1dbc}")
1638 .push_slice(b";")
1639 .push_other(T::SIGNATURE)
1640 .push_slice(b")");
1641 const NAME: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
1642 .push_slice(b"Windows.Foundation.Collections.IObservableVector`1<")
1643 .push_other(T::NAME)
1644 .push_slice(b">");
1645}
1646impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<IIterable<T>>
1647 for IObservableVector<T>
1648{
1649 const QUERY: bool = true;
1650}
1651impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<IVector<T>>
1652 for IObservableVector<T>
1653{
1654 const QUERY: bool = true;
1655}
1656impl<T: windows_core::RuntimeType + 'static> IObservableVector<T> {
1657 pub fn VectorChanged<F>(&self, handler: F) -> windows_core::Result<windows_core::EventRevoker>
1658 where
1659 F: Fn(windows_core::Ref<Self>, windows_core::Ref<IVectorChangedEventArgs>) + Send + 'static,
1660 {
1661 let handler = <VectorChangedEventHandler<T>>::new(move |a0, a1| {
1662 handler(a0, a1);
1663 Ok(())
1664 });
1665 unsafe {
1666 let mut result__ = core::mem::zeroed();
1667 let token__ = (windows_core::Interface::vtable(self).VectorChanged)(
1668 windows_core::Interface::as_raw(self),
1669 windows_core::Interface::as_raw(&handler),
1670 &mut result__,
1671 )
1672 .map(|| result__)?;
1673 Ok(windows_core::EventRevoker::new(
1674 self.clone(),
1675 token__,
1676 windows_core::Interface::vtable(self).RemoveVectorChanged,
1677 ))
1678 }
1679 }
1680 pub fn First(&self) -> windows_core::Result<IIterator<T>> {
1681 let this = &windows_core::Interface::cast::<IIterable<T>>(self)?;
1682 unsafe {
1683 let mut result__ = core::mem::zeroed();
1684 (windows_core::Interface::vtable(this).First)(
1685 windows_core::Interface::as_raw(this),
1686 &mut result__,
1687 )
1688 .and_then(|| windows_core::imp::Type::from_abi(result__))
1689 }
1690 }
1691 pub fn GetAt(&self, index: u32) -> windows_core::Result<T> {
1692 let this = &windows_core::Interface::cast::<IVector<T>>(self)?;
1693 unsafe {
1694 let mut result__ = core::mem::zeroed();
1695 (windows_core::Interface::vtable(this).GetAt)(
1696 windows_core::Interface::as_raw(this),
1697 index,
1698 &mut result__,
1699 )
1700 .and_then(|| windows_core::imp::Type::from_abi(result__))
1701 }
1702 }
1703 pub fn Size(&self) -> windows_core::Result<u32> {
1704 let this = &windows_core::Interface::cast::<IVector<T>>(self)?;
1705 unsafe {
1706 let mut result__ = core::mem::zeroed();
1707 (windows_core::Interface::vtable(this).Size)(
1708 windows_core::Interface::as_raw(this),
1709 &mut result__,
1710 )
1711 .map(|| result__)
1712 }
1713 }
1714 pub fn GetView(&self) -> windows_core::Result<IVectorView<T>> {
1715 let this = &windows_core::Interface::cast::<IVector<T>>(self)?;
1716 unsafe {
1717 let mut result__ = core::mem::zeroed();
1718 (windows_core::Interface::vtable(this).GetView)(
1719 windows_core::Interface::as_raw(this),
1720 &mut result__,
1721 )
1722 .and_then(|| windows_core::imp::Type::from_abi(result__))
1723 }
1724 }
1725 pub fn IndexOf<P0>(&self, value: P0, index: &mut u32) -> windows_core::Result<bool>
1726 where
1727 P0: windows_core::Param<T>,
1728 {
1729 let this = &windows_core::Interface::cast::<IVector<T>>(self)?;
1730 unsafe {
1731 let mut result__ = core::mem::zeroed();
1732 (windows_core::Interface::vtable(this).IndexOf)(
1733 windows_core::Interface::as_raw(this),
1734 value.param().abi(),
1735 index,
1736 &mut result__,
1737 )
1738 .map(|| result__)
1739 }
1740 }
1741 pub fn SetAt<P1>(&self, index: u32, value: P1) -> windows_core::Result<()>
1742 where
1743 P1: windows_core::Param<T>,
1744 {
1745 let this = &windows_core::Interface::cast::<IVector<T>>(self)?;
1746 unsafe {
1747 (windows_core::Interface::vtable(this).SetAt)(
1748 windows_core::Interface::as_raw(this),
1749 index,
1750 value.param().abi(),
1751 )
1752 .ok()
1753 }
1754 }
1755 pub fn InsertAt<P1>(&self, index: u32, value: P1) -> windows_core::Result<()>
1756 where
1757 P1: windows_core::Param<T>,
1758 {
1759 let this = &windows_core::Interface::cast::<IVector<T>>(self)?;
1760 unsafe {
1761 (windows_core::Interface::vtable(this).InsertAt)(
1762 windows_core::Interface::as_raw(this),
1763 index,
1764 value.param().abi(),
1765 )
1766 .ok()
1767 }
1768 }
1769 pub fn RemoveAt(&self, index: u32) -> windows_core::Result<()> {
1770 let this = &windows_core::Interface::cast::<IVector<T>>(self)?;
1771 unsafe {
1772 (windows_core::Interface::vtable(this).RemoveAt)(
1773 windows_core::Interface::as_raw(this),
1774 index,
1775 )
1776 .ok()
1777 }
1778 }
1779 pub fn Append<P0>(&self, value: P0) -> windows_core::Result<()>
1780 where
1781 P0: windows_core::Param<T>,
1782 {
1783 let this = &windows_core::Interface::cast::<IVector<T>>(self)?;
1784 unsafe {
1785 (windows_core::Interface::vtable(this).Append)(
1786 windows_core::Interface::as_raw(this),
1787 value.param().abi(),
1788 )
1789 .ok()
1790 }
1791 }
1792 pub fn RemoveAtEnd(&self) -> windows_core::Result<()> {
1793 let this = &windows_core::Interface::cast::<IVector<T>>(self)?;
1794 unsafe {
1795 (windows_core::Interface::vtable(this).RemoveAtEnd)(windows_core::Interface::as_raw(
1796 this,
1797 ))
1798 .ok()
1799 }
1800 }
1801 pub fn Clear(&self) -> windows_core::Result<()> {
1802 let this = &windows_core::Interface::cast::<IVector<T>>(self)?;
1803 unsafe {
1804 (windows_core::Interface::vtable(this).Clear)(windows_core::Interface::as_raw(this))
1805 .ok()
1806 }
1807 }
1808 pub fn GetMany(
1809 &self,
1810 startindex: u32,
1811 items: &mut [<T as windows_core::imp::Type<T>>::Default],
1812 ) -> windows_core::Result<u32> {
1813 let this = &windows_core::Interface::cast::<IVector<T>>(self)?;
1814 unsafe {
1815 let mut result__ = core::mem::zeroed();
1816 (windows_core::Interface::vtable(this).GetMany)(
1817 windows_core::Interface::as_raw(this),
1818 startindex,
1819 items.len().try_into().unwrap(),
1820 core::mem::transmute_copy(&items),
1821 &mut result__,
1822 )
1823 .map(|| result__)
1824 }
1825 }
1826 pub fn ReplaceAll(
1827 &self,
1828 items: &[<T as windows_core::imp::Type<T>>::Default],
1829 ) -> windows_core::Result<()> {
1830 let this = &windows_core::Interface::cast::<IVector<T>>(self)?;
1831 unsafe {
1832 (windows_core::Interface::vtable(this).ReplaceAll)(
1833 windows_core::Interface::as_raw(this),
1834 items.len().try_into().unwrap(),
1835 core::mem::transmute(items.as_ptr()),
1836 )
1837 .ok()
1838 }
1839 }
1840}
1841impl<T: windows_core::RuntimeType + 'static> IntoIterator for IObservableVector<T> {
1842 type Item = T;
1843 type IntoIter = windows_collections::BufferedIterator<Self::Item>;
1844 fn into_iter(self) -> Self::IntoIter {
1845 IntoIterator::into_iter(&self)
1846 }
1847}
1848impl<T: windows_core::RuntimeType + 'static> IntoIterator for &IObservableVector<T> {
1849 type Item = T;
1850 type IntoIter = windows_collections::BufferedIterator<Self::Item>;
1851 fn into_iter(self) -> Self::IntoIter {
1852 windows_collections::BufferedIterator::new(self.First().unwrap())
1853 }
1854}
1855impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeName for IObservableVector<T> {
1856 const NAME: &'static str = "Windows.Foundation.Collections.IObservableVector";
1857 const RUNTIME_CLASS_NAME: windows_core::imp::ConstBuffer =
1858 <Self as windows_core::RuntimeType>::NAME;
1859}
1860pub trait IObservableVector_Impl<T>: IIterable_Impl<T> + IVector_Impl<T>
1861where
1862 T: windows_core::RuntimeType + 'static,
1863{
1864 fn VectorChanged(
1865 &self,
1866 handler: windows_core::Ref<VectorChangedEventHandler<T>>,
1867 ) -> windows_core::Result<i64>;
1868 fn RemoveVectorChanged(&self, token: i64) -> windows_core::Result<()>;
1869}
1870impl<T: windows_core::RuntimeType + 'static> IObservableVector_Vtbl<T> {
1871 pub const fn new<Identity: IObservableVector_Impl<T>, const OFFSET: isize>() -> Self {
1872 unsafe extern "system" fn VectorChanged<
1873 T: windows_core::RuntimeType + 'static,
1874 Identity: IObservableVector_Impl<T>,
1875 const OFFSET: isize,
1876 >(
1877 this: *mut core::ffi::c_void,
1878 handler: *mut core::ffi::c_void,
1879 result__: *mut i64,
1880 ) -> windows_core::HRESULT {
1881 unsafe {
1882 let this: &Identity =
1883 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
1884 match IObservableVector_Impl::VectorChanged(
1885 this,
1886 core::mem::transmute_copy(&handler),
1887 ) {
1888 Ok(ok__) => {
1889 result__.write(ok__);
1890 windows_core::HRESULT(0)
1891 }
1892 Err(err) => err.into(),
1893 }
1894 }
1895 }
1896 unsafe extern "system" fn RemoveVectorChanged<
1897 T: windows_core::RuntimeType + 'static,
1898 Identity: IObservableVector_Impl<T>,
1899 const OFFSET: isize,
1900 >(
1901 this: *mut core::ffi::c_void,
1902 token: i64,
1903 ) -> windows_core::HRESULT {
1904 unsafe {
1905 let this: &Identity =
1906 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
1907 IObservableVector_Impl::RemoveVectorChanged(this, token).into()
1908 }
1909 }
1910 Self {
1911 base__: windows_core::IInspectable_Vtbl::new::<Identity, IObservableVector<T>, OFFSET>(
1912 ),
1913 VectorChanged: VectorChanged::<T, Identity, OFFSET>,
1914 RemoveVectorChanged: RemoveVectorChanged::<T, Identity, OFFSET>,
1915 T: core::marker::PhantomData::<T>,
1916 }
1917 }
1918 pub fn matches(iid: &windows_core::GUID) -> bool {
1919 iid == &<IObservableVector<T> as windows_core::Interface>::IID
1920 }
1921}
1922#[repr(C)]
1923pub struct IObservableVector_Vtbl<T>
1924where
1925 T: windows_core::RuntimeType + 'static,
1926{
1927 pub base__: windows_core::IInspectable_Vtbl,
1928 pub VectorChanged: unsafe extern "system" fn(
1929 *mut core::ffi::c_void,
1930 *mut core::ffi::c_void,
1931 *mut i64,
1932 ) -> windows_core::HRESULT,
1933 pub RemoveVectorChanged:
1934 unsafe extern "system" fn(*mut core::ffi::c_void, i64) -> windows_core::HRESULT,
1935 T: core::marker::PhantomData<T>,
1936}
1937#[repr(transparent)]
1938#[derive(Clone, Debug, Eq, PartialEq)]
1939pub struct IVector<T>(windows_core::IUnknown, core::marker::PhantomData<T>)
1940where
1941 T: windows_core::RuntimeType + 'static;
1942impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IUnknown>
1943 for IVector<T>
1944{
1945}
1946impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IInspectable>
1947 for IVector<T>
1948{
1949}
1950unsafe impl<T: windows_core::RuntimeType + 'static> windows_core::Interface for IVector<T> {
1951 type Vtable = IVector_Vtbl<T>;
1952 const IID: windows_core::GUID =
1953 windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE);
1954}
1955impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeType for IVector<T> {
1956 const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
1957 .push_slice(b"pinterface({913337e9-11a1-4345-a3a2-4e7f956e222d}")
1958 .push_slice(b";")
1959 .push_other(T::SIGNATURE)
1960 .push_slice(b")");
1961 const NAME: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
1962 .push_slice(b"Windows.Foundation.Collections.IVector`1<")
1963 .push_other(T::NAME)
1964 .push_slice(b">");
1965}
1966impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<IIterable<T>>
1967 for IVector<T>
1968{
1969 const QUERY: bool = true;
1970}
1971impl<T: windows_core::RuntimeType + 'static> IVector<T> {
1972 pub fn GetAt(&self, index: u32) -> windows_core::Result<T> {
1973 unsafe {
1974 let mut result__ = core::mem::zeroed();
1975 (windows_core::Interface::vtable(self).GetAt)(
1976 windows_core::Interface::as_raw(self),
1977 index,
1978 &mut result__,
1979 )
1980 .and_then(|| windows_core::imp::Type::from_abi(result__))
1981 }
1982 }
1983 pub fn Size(&self) -> windows_core::Result<u32> {
1984 unsafe {
1985 let mut result__ = core::mem::zeroed();
1986 (windows_core::Interface::vtable(self).Size)(
1987 windows_core::Interface::as_raw(self),
1988 &mut result__,
1989 )
1990 .map(|| result__)
1991 }
1992 }
1993 pub fn GetView(&self) -> windows_core::Result<IVectorView<T>> {
1994 unsafe {
1995 let mut result__ = core::mem::zeroed();
1996 (windows_core::Interface::vtable(self).GetView)(
1997 windows_core::Interface::as_raw(self),
1998 &mut result__,
1999 )
2000 .and_then(|| windows_core::imp::Type::from_abi(result__))
2001 }
2002 }
2003 pub fn IndexOf<P0>(&self, value: P0, index: &mut u32) -> windows_core::Result<bool>
2004 where
2005 P0: windows_core::Param<T>,
2006 {
2007 unsafe {
2008 let mut result__ = core::mem::zeroed();
2009 (windows_core::Interface::vtable(self).IndexOf)(
2010 windows_core::Interface::as_raw(self),
2011 value.param().abi(),
2012 index,
2013 &mut result__,
2014 )
2015 .map(|| result__)
2016 }
2017 }
2018 pub fn SetAt<P1>(&self, index: u32, value: P1) -> windows_core::Result<()>
2019 where
2020 P1: windows_core::Param<T>,
2021 {
2022 unsafe {
2023 (windows_core::Interface::vtable(self).SetAt)(
2024 windows_core::Interface::as_raw(self),
2025 index,
2026 value.param().abi(),
2027 )
2028 .ok()
2029 }
2030 }
2031 pub fn InsertAt<P1>(&self, index: u32, value: P1) -> windows_core::Result<()>
2032 where
2033 P1: windows_core::Param<T>,
2034 {
2035 unsafe {
2036 (windows_core::Interface::vtable(self).InsertAt)(
2037 windows_core::Interface::as_raw(self),
2038 index,
2039 value.param().abi(),
2040 )
2041 .ok()
2042 }
2043 }
2044 pub fn RemoveAt(&self, index: u32) -> windows_core::Result<()> {
2045 unsafe {
2046 (windows_core::Interface::vtable(self).RemoveAt)(
2047 windows_core::Interface::as_raw(self),
2048 index,
2049 )
2050 .ok()
2051 }
2052 }
2053 pub fn Append<P0>(&self, value: P0) -> windows_core::Result<()>
2054 where
2055 P0: windows_core::Param<T>,
2056 {
2057 unsafe {
2058 (windows_core::Interface::vtable(self).Append)(
2059 windows_core::Interface::as_raw(self),
2060 value.param().abi(),
2061 )
2062 .ok()
2063 }
2064 }
2065 pub fn RemoveAtEnd(&self) -> windows_core::Result<()> {
2066 unsafe {
2067 (windows_core::Interface::vtable(self).RemoveAtEnd)(windows_core::Interface::as_raw(
2068 self,
2069 ))
2070 .ok()
2071 }
2072 }
2073 pub fn Clear(&self) -> windows_core::Result<()> {
2074 unsafe {
2075 (windows_core::Interface::vtable(self).Clear)(windows_core::Interface::as_raw(self))
2076 .ok()
2077 }
2078 }
2079 pub fn GetMany(
2080 &self,
2081 startindex: u32,
2082 items: &mut [<T as windows_core::imp::Type<T>>::Default],
2083 ) -> windows_core::Result<u32> {
2084 unsafe {
2085 let mut result__ = core::mem::zeroed();
2086 (windows_core::Interface::vtable(self).GetMany)(
2087 windows_core::Interface::as_raw(self),
2088 startindex,
2089 items.len().try_into().unwrap(),
2090 core::mem::transmute_copy(&items),
2091 &mut result__,
2092 )
2093 .map(|| result__)
2094 }
2095 }
2096 pub fn ReplaceAll(
2097 &self,
2098 items: &[<T as windows_core::imp::Type<T>>::Default],
2099 ) -> windows_core::Result<()> {
2100 unsafe {
2101 (windows_core::Interface::vtable(self).ReplaceAll)(
2102 windows_core::Interface::as_raw(self),
2103 items.len().try_into().unwrap(),
2104 core::mem::transmute(items.as_ptr()),
2105 )
2106 .ok()
2107 }
2108 }
2109 pub fn First(&self) -> windows_core::Result<IIterator<T>> {
2110 let this = &windows_core::Interface::cast::<IIterable<T>>(self)?;
2111 unsafe {
2112 let mut result__ = core::mem::zeroed();
2113 (windows_core::Interface::vtable(this).First)(
2114 windows_core::Interface::as_raw(this),
2115 &mut result__,
2116 )
2117 .and_then(|| windows_core::imp::Type::from_abi(result__))
2118 }
2119 }
2120}
2121impl<T: windows_core::RuntimeType + 'static> IntoIterator for IVector<T> {
2122 type Item = T;
2123 type IntoIter = windows_collections::BufferedIterator<Self::Item>;
2124 fn into_iter(self) -> Self::IntoIter {
2125 IntoIterator::into_iter(&self)
2126 }
2127}
2128impl<T: windows_core::RuntimeType + 'static> IntoIterator for &IVector<T> {
2129 type Item = T;
2130 type IntoIter = windows_collections::BufferedIterator<Self::Item>;
2131 fn into_iter(self) -> Self::IntoIter {
2132 windows_collections::BufferedIterator::new(self.First().unwrap())
2133 }
2134}
2135impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeName for IVector<T> {
2136 const NAME: &'static str = "Windows.Foundation.Collections.IVector";
2137 const RUNTIME_CLASS_NAME: windows_core::imp::ConstBuffer =
2138 <Self as windows_core::RuntimeType>::NAME;
2139}
2140pub trait IVector_Impl<T>: IIterable_Impl<T>
2141where
2142 T: windows_core::RuntimeType + 'static,
2143{
2144 fn GetAt(&self, index: u32) -> windows_core::Result<T>;
2145 fn Size(&self) -> windows_core::Result<u32>;
2146 fn GetView(&self) -> windows_core::Result<IVectorView<T>>;
2147 fn IndexOf(&self, value: windows_core::Ref<T>, index: &mut u32) -> windows_core::Result<bool>;
2148 fn SetAt(&self, index: u32, value: windows_core::Ref<T>) -> windows_core::Result<()>;
2149 fn InsertAt(&self, index: u32, value: windows_core::Ref<T>) -> windows_core::Result<()>;
2150 fn RemoveAt(&self, index: u32) -> windows_core::Result<()>;
2151 fn Append(&self, value: windows_core::Ref<T>) -> windows_core::Result<()>;
2152 fn RemoveAtEnd(&self) -> windows_core::Result<()>;
2153 fn Clear(&self) -> windows_core::Result<()>;
2154 fn GetMany(
2155 &self,
2156 startIndex: u32,
2157 items: &mut [<T as windows_core::imp::Type<T>>::Default],
2158 ) -> windows_core::Result<u32>;
2159 fn ReplaceAll(
2160 &self,
2161 items: &[<T as windows_core::imp::Type<T>>::Default],
2162 ) -> windows_core::Result<()>;
2163}
2164impl<T: windows_core::RuntimeType + 'static> IVector_Vtbl<T> {
2165 pub const fn new<Identity: IVector_Impl<T>, const OFFSET: isize>() -> Self {
2166 unsafe extern "system" fn GetAt<
2167 T: windows_core::RuntimeType + 'static,
2168 Identity: IVector_Impl<T>,
2169 const OFFSET: isize,
2170 >(
2171 this: *mut core::ffi::c_void,
2172 index: u32,
2173 result__: *mut windows_core::imp::AbiType<T>,
2174 ) -> windows_core::HRESULT {
2175 unsafe {
2176 let this: &Identity =
2177 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2178 match IVector_Impl::GetAt(this, index) {
2179 Ok(ok__) => {
2180 result__.write(core::mem::transmute_copy(&ok__));
2181 core::mem::forget(ok__);
2182 windows_core::HRESULT(0)
2183 }
2184 Err(err) => err.into(),
2185 }
2186 }
2187 }
2188 unsafe extern "system" fn Size<
2189 T: windows_core::RuntimeType + 'static,
2190 Identity: IVector_Impl<T>,
2191 const OFFSET: isize,
2192 >(
2193 this: *mut core::ffi::c_void,
2194 result__: *mut u32,
2195 ) -> windows_core::HRESULT {
2196 unsafe {
2197 let this: &Identity =
2198 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2199 match IVector_Impl::Size(this) {
2200 Ok(ok__) => {
2201 result__.write(ok__);
2202 windows_core::HRESULT(0)
2203 }
2204 Err(err) => err.into(),
2205 }
2206 }
2207 }
2208 unsafe extern "system" fn GetView<
2209 T: windows_core::RuntimeType + 'static,
2210 Identity: IVector_Impl<T>,
2211 const OFFSET: isize,
2212 >(
2213 this: *mut core::ffi::c_void,
2214 result__: *mut *mut core::ffi::c_void,
2215 ) -> windows_core::HRESULT {
2216 unsafe {
2217 let this: &Identity =
2218 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2219 match IVector_Impl::GetView(this) {
2220 Ok(ok__) => {
2221 result__.write(core::mem::transmute_copy(&ok__));
2222 core::mem::forget(ok__);
2223 windows_core::HRESULT(0)
2224 }
2225 Err(err) => err.into(),
2226 }
2227 }
2228 }
2229 unsafe extern "system" fn IndexOf<
2230 T: windows_core::RuntimeType + 'static,
2231 Identity: IVector_Impl<T>,
2232 const OFFSET: isize,
2233 >(
2234 this: *mut core::ffi::c_void,
2235 value: windows_core::imp::AbiType<T>,
2236 index: *mut u32,
2237 result__: *mut bool,
2238 ) -> windows_core::HRESULT {
2239 unsafe {
2240 let this: &Identity =
2241 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2242 match IVector_Impl::IndexOf(
2243 this,
2244 core::mem::transmute_copy(&value),
2245 core::mem::transmute_copy(&index),
2246 ) {
2247 Ok(ok__) => {
2248 result__.write(ok__);
2249 windows_core::HRESULT(0)
2250 }
2251 Err(err) => err.into(),
2252 }
2253 }
2254 }
2255 unsafe extern "system" fn SetAt<
2256 T: windows_core::RuntimeType + 'static,
2257 Identity: IVector_Impl<T>,
2258 const OFFSET: isize,
2259 >(
2260 this: *mut core::ffi::c_void,
2261 index: u32,
2262 value: windows_core::imp::AbiType<T>,
2263 ) -> windows_core::HRESULT {
2264 unsafe {
2265 let this: &Identity =
2266 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2267 IVector_Impl::SetAt(this, index, core::mem::transmute_copy(&value)).into()
2268 }
2269 }
2270 unsafe extern "system" fn InsertAt<
2271 T: windows_core::RuntimeType + 'static,
2272 Identity: IVector_Impl<T>,
2273 const OFFSET: isize,
2274 >(
2275 this: *mut core::ffi::c_void,
2276 index: u32,
2277 value: windows_core::imp::AbiType<T>,
2278 ) -> windows_core::HRESULT {
2279 unsafe {
2280 let this: &Identity =
2281 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2282 IVector_Impl::InsertAt(this, index, core::mem::transmute_copy(&value)).into()
2283 }
2284 }
2285 unsafe extern "system" fn RemoveAt<
2286 T: windows_core::RuntimeType + 'static,
2287 Identity: IVector_Impl<T>,
2288 const OFFSET: isize,
2289 >(
2290 this: *mut core::ffi::c_void,
2291 index: u32,
2292 ) -> windows_core::HRESULT {
2293 unsafe {
2294 let this: &Identity =
2295 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2296 IVector_Impl::RemoveAt(this, index).into()
2297 }
2298 }
2299 unsafe extern "system" fn Append<
2300 T: windows_core::RuntimeType + 'static,
2301 Identity: IVector_Impl<T>,
2302 const OFFSET: isize,
2303 >(
2304 this: *mut core::ffi::c_void,
2305 value: windows_core::imp::AbiType<T>,
2306 ) -> windows_core::HRESULT {
2307 unsafe {
2308 let this: &Identity =
2309 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2310 IVector_Impl::Append(this, core::mem::transmute_copy(&value)).into()
2311 }
2312 }
2313 unsafe extern "system" fn RemoveAtEnd<
2314 T: windows_core::RuntimeType + 'static,
2315 Identity: IVector_Impl<T>,
2316 const OFFSET: isize,
2317 >(
2318 this: *mut core::ffi::c_void,
2319 ) -> windows_core::HRESULT {
2320 unsafe {
2321 let this: &Identity =
2322 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2323 IVector_Impl::RemoveAtEnd(this).into()
2324 }
2325 }
2326 unsafe extern "system" fn Clear<
2327 T: windows_core::RuntimeType + 'static,
2328 Identity: IVector_Impl<T>,
2329 const OFFSET: isize,
2330 >(
2331 this: *mut core::ffi::c_void,
2332 ) -> windows_core::HRESULT {
2333 unsafe {
2334 let this: &Identity =
2335 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2336 IVector_Impl::Clear(this).into()
2337 }
2338 }
2339 unsafe extern "system" fn GetMany<
2340 T: windows_core::RuntimeType + 'static,
2341 Identity: IVector_Impl<T>,
2342 const OFFSET: isize,
2343 >(
2344 this: *mut core::ffi::c_void,
2345 startindex: u32,
2346 items_array_size: u32,
2347 items: *mut windows_core::imp::AbiType<T>,
2348 result__: *mut u32,
2349 ) -> windows_core::HRESULT {
2350 unsafe {
2351 let this: &Identity =
2352 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2353 match IVector_Impl::GetMany(
2354 this,
2355 startindex,
2356 core::slice::from_raw_parts_mut(
2357 core::mem::transmute_copy(&items),
2358 items_array_size as usize,
2359 ),
2360 ) {
2361 Ok(ok__) => {
2362 result__.write(ok__);
2363 windows_core::HRESULT(0)
2364 }
2365 Err(err) => err.into(),
2366 }
2367 }
2368 }
2369 unsafe extern "system" fn ReplaceAll<
2370 T: windows_core::RuntimeType + 'static,
2371 Identity: IVector_Impl<T>,
2372 const OFFSET: isize,
2373 >(
2374 this: *mut core::ffi::c_void,
2375 items_array_size: u32,
2376 items: *const windows_core::imp::AbiType<T>,
2377 ) -> windows_core::HRESULT {
2378 unsafe {
2379 let this: &Identity =
2380 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2381 IVector_Impl::ReplaceAll(
2382 this,
2383 core::slice::from_raw_parts(
2384 core::mem::transmute_copy(&items),
2385 items_array_size as usize,
2386 ),
2387 )
2388 .into()
2389 }
2390 }
2391 Self {
2392 base__: windows_core::IInspectable_Vtbl::new::<Identity, IVector<T>, OFFSET>(),
2393 GetAt: GetAt::<T, Identity, OFFSET>,
2394 Size: Size::<T, Identity, OFFSET>,
2395 GetView: GetView::<T, Identity, OFFSET>,
2396 IndexOf: IndexOf::<T, Identity, OFFSET>,
2397 SetAt: SetAt::<T, Identity, OFFSET>,
2398 InsertAt: InsertAt::<T, Identity, OFFSET>,
2399 RemoveAt: RemoveAt::<T, Identity, OFFSET>,
2400 Append: Append::<T, Identity, OFFSET>,
2401 RemoveAtEnd: RemoveAtEnd::<T, Identity, OFFSET>,
2402 Clear: Clear::<T, Identity, OFFSET>,
2403 GetMany: GetMany::<T, Identity, OFFSET>,
2404 ReplaceAll: ReplaceAll::<T, Identity, OFFSET>,
2405 T: core::marker::PhantomData::<T>,
2406 }
2407 }
2408 pub fn matches(iid: &windows_core::GUID) -> bool {
2409 iid == &<IVector<T> as windows_core::Interface>::IID
2410 }
2411}
2412#[repr(C)]
2413pub struct IVector_Vtbl<T>
2414where
2415 T: windows_core::RuntimeType + 'static,
2416{
2417 pub base__: windows_core::IInspectable_Vtbl,
2418 pub GetAt: unsafe extern "system" fn(
2419 *mut core::ffi::c_void,
2420 u32,
2421 *mut windows_core::imp::AbiType<T>,
2422 ) -> windows_core::HRESULT,
2423 pub Size: unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> windows_core::HRESULT,
2424 pub GetView: unsafe extern "system" fn(
2425 *mut core::ffi::c_void,
2426 *mut *mut core::ffi::c_void,
2427 ) -> windows_core::HRESULT,
2428 pub IndexOf: unsafe extern "system" fn(
2429 *mut core::ffi::c_void,
2430 windows_core::imp::AbiType<T>,
2431 *mut u32,
2432 *mut bool,
2433 ) -> windows_core::HRESULT,
2434 pub SetAt: unsafe extern "system" fn(
2435 *mut core::ffi::c_void,
2436 u32,
2437 windows_core::imp::AbiType<T>,
2438 ) -> windows_core::HRESULT,
2439 pub InsertAt: unsafe extern "system" fn(
2440 *mut core::ffi::c_void,
2441 u32,
2442 windows_core::imp::AbiType<T>,
2443 ) -> windows_core::HRESULT,
2444 pub RemoveAt: unsafe extern "system" fn(*mut core::ffi::c_void, u32) -> windows_core::HRESULT,
2445 pub Append: unsafe extern "system" fn(
2446 *mut core::ffi::c_void,
2447 windows_core::imp::AbiType<T>,
2448 ) -> windows_core::HRESULT,
2449 pub RemoveAtEnd: unsafe extern "system" fn(*mut core::ffi::c_void) -> windows_core::HRESULT,
2450 pub Clear: unsafe extern "system" fn(*mut core::ffi::c_void) -> windows_core::HRESULT,
2451 pub GetMany: unsafe extern "system" fn(
2452 *mut core::ffi::c_void,
2453 u32,
2454 u32,
2455 *mut windows_core::imp::AbiType<T>,
2456 *mut u32,
2457 ) -> windows_core::HRESULT,
2458 pub ReplaceAll: unsafe extern "system" fn(
2459 *mut core::ffi::c_void,
2460 u32,
2461 *const windows_core::imp::AbiType<T>,
2462 ) -> windows_core::HRESULT,
2463 T: core::marker::PhantomData<T>,
2464}
2465windows_core::imp::define_interface!(
2466 IVectorChangedEventArgs,
2467 IVectorChangedEventArgs_Vtbl,
2468 0x575933df_34fe_4480_af15_07691f3d5d9b
2469);
2470impl windows_core::RuntimeType for IVectorChangedEventArgs {
2471 const SIGNATURE: windows_core::imp::ConstBuffer =
2472 windows_core::imp::ConstBuffer::for_interface::<Self>();
2473 const NAME: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::from_slice(
2474 b"Windows.Foundation.Collections.IVectorChangedEventArgs",
2475 );
2476}
2477windows_core::imp::interface_hierarchy!(
2478 IVectorChangedEventArgs,
2479 windows_core::IUnknown,
2480 windows_core::IInspectable
2481);
2482impl IVectorChangedEventArgs {
2483 pub fn CollectionChange(&self) -> windows_core::Result<CollectionChange> {
2484 unsafe {
2485 let mut result__ = core::mem::zeroed();
2486 (windows_core::Interface::vtable(self).CollectionChange)(
2487 windows_core::Interface::as_raw(self),
2488 &mut result__,
2489 )
2490 .map(|| result__)
2491 }
2492 }
2493 pub fn Index(&self) -> windows_core::Result<u32> {
2494 unsafe {
2495 let mut result__ = core::mem::zeroed();
2496 (windows_core::Interface::vtable(self).Index)(
2497 windows_core::Interface::as_raw(self),
2498 &mut result__,
2499 )
2500 .map(|| result__)
2501 }
2502 }
2503}
2504impl windows_core::RuntimeName for IVectorChangedEventArgs {
2505 const NAME: &'static str = "Windows.Foundation.Collections.IVectorChangedEventArgs";
2506}
2507pub trait IVectorChangedEventArgs_Impl: windows_core::IUnknownImpl {
2508 fn CollectionChange(&self) -> windows_core::Result<CollectionChange>;
2509 fn Index(&self) -> windows_core::Result<u32>;
2510}
2511impl IVectorChangedEventArgs_Vtbl {
2512 pub const fn new<Identity: IVectorChangedEventArgs_Impl, const OFFSET: isize>() -> Self {
2513 unsafe extern "system" fn CollectionChange<
2514 Identity: IVectorChangedEventArgs_Impl,
2515 const OFFSET: isize,
2516 >(
2517 this: *mut core::ffi::c_void,
2518 result__: *mut CollectionChange,
2519 ) -> windows_core::HRESULT {
2520 unsafe {
2521 let this: &Identity =
2522 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2523 match IVectorChangedEventArgs_Impl::CollectionChange(this) {
2524 Ok(ok__) => {
2525 result__.write(ok__);
2526 windows_core::HRESULT(0)
2527 }
2528 Err(err) => err.into(),
2529 }
2530 }
2531 }
2532 unsafe extern "system" fn Index<
2533 Identity: IVectorChangedEventArgs_Impl,
2534 const OFFSET: isize,
2535 >(
2536 this: *mut core::ffi::c_void,
2537 result__: *mut u32,
2538 ) -> windows_core::HRESULT {
2539 unsafe {
2540 let this: &Identity =
2541 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2542 match IVectorChangedEventArgs_Impl::Index(this) {
2543 Ok(ok__) => {
2544 result__.write(ok__);
2545 windows_core::HRESULT(0)
2546 }
2547 Err(err) => err.into(),
2548 }
2549 }
2550 }
2551 Self {
2552 base__: windows_core::IInspectable_Vtbl::new::<Identity, IVectorChangedEventArgs, OFFSET>(
2553 ),
2554 CollectionChange: CollectionChange::<Identity, OFFSET>,
2555 Index: Index::<Identity, OFFSET>,
2556 }
2557 }
2558 pub fn matches(iid: &windows_core::GUID) -> bool {
2559 iid == &<IVectorChangedEventArgs as windows_core::Interface>::IID
2560 }
2561}
2562#[repr(C)]
2563pub struct IVectorChangedEventArgs_Vtbl {
2564 pub base__: windows_core::IInspectable_Vtbl,
2565 pub CollectionChange: unsafe extern "system" fn(
2566 *mut core::ffi::c_void,
2567 *mut CollectionChange,
2568 ) -> windows_core::HRESULT,
2569 pub Index: unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> windows_core::HRESULT,
2570}
2571#[repr(transparent)]
2572#[derive(Clone, Debug, Eq, PartialEq)]
2573pub struct IVectorView<T>(windows_core::IUnknown, core::marker::PhantomData<T>)
2574where
2575 T: windows_core::RuntimeType + 'static;
2576impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IUnknown>
2577 for IVectorView<T>
2578{
2579}
2580impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<windows_core::IInspectable>
2581 for IVectorView<T>
2582{
2583}
2584unsafe impl<T: windows_core::RuntimeType + 'static> windows_core::Interface for IVectorView<T> {
2585 type Vtable = IVectorView_Vtbl<T>;
2586 const IID: windows_core::GUID =
2587 windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE);
2588}
2589impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeType for IVectorView<T> {
2590 const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
2591 .push_slice(b"pinterface({bbe1fa4c-b0e3-4583-baef-1f1b2e483e56}")
2592 .push_slice(b";")
2593 .push_other(T::SIGNATURE)
2594 .push_slice(b")");
2595 const NAME: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
2596 .push_slice(b"Windows.Foundation.Collections.IVectorView`1<")
2597 .push_other(T::NAME)
2598 .push_slice(b">");
2599}
2600impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<IIterable<T>>
2601 for IVectorView<T>
2602{
2603 const QUERY: bool = true;
2604}
2605impl<T: windows_core::RuntimeType + 'static> IVectorView<T> {
2606 pub fn GetAt(&self, index: u32) -> windows_core::Result<T> {
2607 unsafe {
2608 let mut result__ = core::mem::zeroed();
2609 (windows_core::Interface::vtable(self).GetAt)(
2610 windows_core::Interface::as_raw(self),
2611 index,
2612 &mut result__,
2613 )
2614 .and_then(|| windows_core::imp::Type::from_abi(result__))
2615 }
2616 }
2617 pub fn Size(&self) -> windows_core::Result<u32> {
2618 unsafe {
2619 let mut result__ = core::mem::zeroed();
2620 (windows_core::Interface::vtable(self).Size)(
2621 windows_core::Interface::as_raw(self),
2622 &mut result__,
2623 )
2624 .map(|| result__)
2625 }
2626 }
2627 pub fn IndexOf<P0>(&self, value: P0, index: &mut u32) -> windows_core::Result<bool>
2628 where
2629 P0: windows_core::Param<T>,
2630 {
2631 unsafe {
2632 let mut result__ = core::mem::zeroed();
2633 (windows_core::Interface::vtable(self).IndexOf)(
2634 windows_core::Interface::as_raw(self),
2635 value.param().abi(),
2636 index,
2637 &mut result__,
2638 )
2639 .map(|| result__)
2640 }
2641 }
2642 pub fn GetMany(
2643 &self,
2644 startindex: u32,
2645 items: &mut [<T as windows_core::imp::Type<T>>::Default],
2646 ) -> windows_core::Result<u32> {
2647 unsafe {
2648 let mut result__ = core::mem::zeroed();
2649 (windows_core::Interface::vtable(self).GetMany)(
2650 windows_core::Interface::as_raw(self),
2651 startindex,
2652 items.len().try_into().unwrap(),
2653 core::mem::transmute_copy(&items),
2654 &mut result__,
2655 )
2656 .map(|| result__)
2657 }
2658 }
2659 pub fn First(&self) -> windows_core::Result<IIterator<T>> {
2660 let this = &windows_core::Interface::cast::<IIterable<T>>(self)?;
2661 unsafe {
2662 let mut result__ = core::mem::zeroed();
2663 (windows_core::Interface::vtable(this).First)(
2664 windows_core::Interface::as_raw(this),
2665 &mut result__,
2666 )
2667 .and_then(|| windows_core::imp::Type::from_abi(result__))
2668 }
2669 }
2670}
2671impl<T: windows_core::RuntimeType + 'static> IntoIterator for IVectorView<T> {
2672 type Item = T;
2673 type IntoIter = windows_collections::BufferedIterator<Self::Item>;
2674 fn into_iter(self) -> Self::IntoIter {
2675 IntoIterator::into_iter(&self)
2676 }
2677}
2678impl<T: windows_core::RuntimeType + 'static> IntoIterator for &IVectorView<T> {
2679 type Item = T;
2680 type IntoIter = windows_collections::BufferedIterator<Self::Item>;
2681 fn into_iter(self) -> Self::IntoIter {
2682 windows_collections::BufferedIterator::new(self.First().unwrap())
2683 }
2684}
2685impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeName for IVectorView<T> {
2686 const NAME: &'static str = "Windows.Foundation.Collections.IVectorView";
2687 const RUNTIME_CLASS_NAME: windows_core::imp::ConstBuffer =
2688 <Self as windows_core::RuntimeType>::NAME;
2689}
2690pub trait IVectorView_Impl<T>: IIterable_Impl<T>
2691where
2692 T: windows_core::RuntimeType + 'static,
2693{
2694 fn GetAt(&self, index: u32) -> windows_core::Result<T>;
2695 fn Size(&self) -> windows_core::Result<u32>;
2696 fn IndexOf(&self, value: windows_core::Ref<T>, index: &mut u32) -> windows_core::Result<bool>;
2697 fn GetMany(
2698 &self,
2699 startIndex: u32,
2700 items: &mut [<T as windows_core::imp::Type<T>>::Default],
2701 ) -> windows_core::Result<u32>;
2702}
2703impl<T: windows_core::RuntimeType + 'static> IVectorView_Vtbl<T> {
2704 pub const fn new<Identity: IVectorView_Impl<T>, const OFFSET: isize>() -> Self {
2705 unsafe extern "system" fn GetAt<
2706 T: windows_core::RuntimeType + 'static,
2707 Identity: IVectorView_Impl<T>,
2708 const OFFSET: isize,
2709 >(
2710 this: *mut core::ffi::c_void,
2711 index: u32,
2712 result__: *mut windows_core::imp::AbiType<T>,
2713 ) -> windows_core::HRESULT {
2714 unsafe {
2715 let this: &Identity =
2716 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2717 match IVectorView_Impl::GetAt(this, index) {
2718 Ok(ok__) => {
2719 result__.write(core::mem::transmute_copy(&ok__));
2720 core::mem::forget(ok__);
2721 windows_core::HRESULT(0)
2722 }
2723 Err(err) => err.into(),
2724 }
2725 }
2726 }
2727 unsafe extern "system" fn Size<
2728 T: windows_core::RuntimeType + 'static,
2729 Identity: IVectorView_Impl<T>,
2730 const OFFSET: isize,
2731 >(
2732 this: *mut core::ffi::c_void,
2733 result__: *mut u32,
2734 ) -> windows_core::HRESULT {
2735 unsafe {
2736 let this: &Identity =
2737 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2738 match IVectorView_Impl::Size(this) {
2739 Ok(ok__) => {
2740 result__.write(ok__);
2741 windows_core::HRESULT(0)
2742 }
2743 Err(err) => err.into(),
2744 }
2745 }
2746 }
2747 unsafe extern "system" fn IndexOf<
2748 T: windows_core::RuntimeType + 'static,
2749 Identity: IVectorView_Impl<T>,
2750 const OFFSET: isize,
2751 >(
2752 this: *mut core::ffi::c_void,
2753 value: windows_core::imp::AbiType<T>,
2754 index: *mut u32,
2755 result__: *mut bool,
2756 ) -> windows_core::HRESULT {
2757 unsafe {
2758 let this: &Identity =
2759 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2760 match IVectorView_Impl::IndexOf(
2761 this,
2762 core::mem::transmute_copy(&value),
2763 core::mem::transmute_copy(&index),
2764 ) {
2765 Ok(ok__) => {
2766 result__.write(ok__);
2767 windows_core::HRESULT(0)
2768 }
2769 Err(err) => err.into(),
2770 }
2771 }
2772 }
2773 unsafe extern "system" fn GetMany<
2774 T: windows_core::RuntimeType + 'static,
2775 Identity: IVectorView_Impl<T>,
2776 const OFFSET: isize,
2777 >(
2778 this: *mut core::ffi::c_void,
2779 startindex: u32,
2780 items_array_size: u32,
2781 items: *mut windows_core::imp::AbiType<T>,
2782 result__: *mut u32,
2783 ) -> windows_core::HRESULT {
2784 unsafe {
2785 let this: &Identity =
2786 &*((this as *const *const ()).offset(OFFSET) as *const Identity);
2787 match IVectorView_Impl::GetMany(
2788 this,
2789 startindex,
2790 core::slice::from_raw_parts_mut(
2791 core::mem::transmute_copy(&items),
2792 items_array_size as usize,
2793 ),
2794 ) {
2795 Ok(ok__) => {
2796 result__.write(ok__);
2797 windows_core::HRESULT(0)
2798 }
2799 Err(err) => err.into(),
2800 }
2801 }
2802 }
2803 Self {
2804 base__: windows_core::IInspectable_Vtbl::new::<Identity, IVectorView<T>, OFFSET>(),
2805 GetAt: GetAt::<T, Identity, OFFSET>,
2806 Size: Size::<T, Identity, OFFSET>,
2807 IndexOf: IndexOf::<T, Identity, OFFSET>,
2808 GetMany: GetMany::<T, Identity, OFFSET>,
2809 T: core::marker::PhantomData::<T>,
2810 }
2811 }
2812 pub fn matches(iid: &windows_core::GUID) -> bool {
2813 iid == &<IVectorView<T> as windows_core::Interface>::IID
2814 }
2815}
2816#[repr(C)]
2817pub struct IVectorView_Vtbl<T>
2818where
2819 T: windows_core::RuntimeType + 'static,
2820{
2821 pub base__: windows_core::IInspectable_Vtbl,
2822 pub GetAt: unsafe extern "system" fn(
2823 *mut core::ffi::c_void,
2824 u32,
2825 *mut windows_core::imp::AbiType<T>,
2826 ) -> windows_core::HRESULT,
2827 pub Size: unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> windows_core::HRESULT,
2828 pub IndexOf: unsafe extern "system" fn(
2829 *mut core::ffi::c_void,
2830 windows_core::imp::AbiType<T>,
2831 *mut u32,
2832 *mut bool,
2833 ) -> windows_core::HRESULT,
2834 pub GetMany: unsafe extern "system" fn(
2835 *mut core::ffi::c_void,
2836 u32,
2837 u32,
2838 *mut windows_core::imp::AbiType<T>,
2839 *mut u32,
2840 ) -> windows_core::HRESULT,
2841 T: core::marker::PhantomData<T>,
2842}
2843#[repr(transparent)]
2844#[derive(Clone, Debug, Eq, PartialEq)]
2845pub struct MapChangedEventHandler<K, V>(
2846 windows_core::IUnknown,
2847 core::marker::PhantomData<K>,
2848 core::marker::PhantomData<V>,
2849)
2850where
2851 K: windows_core::RuntimeType + 'static,
2852 V: windows_core::RuntimeType + 'static;
2853unsafe impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
2854 windows_core::Interface for MapChangedEventHandler<K, V>
2855{
2856 type Vtable = MapChangedEventHandler_Vtbl<K, V>;
2857 const IID: windows_core::GUID =
2858 windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE);
2859}
2860impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
2861 windows_core::RuntimeType for MapChangedEventHandler<K, V>
2862{
2863 const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
2864 .push_slice(b"pinterface({179517f3-94ee-41f8-bddc-768a895544f3}")
2865 .push_slice(b";")
2866 .push_other(K::SIGNATURE)
2867 .push_slice(b";")
2868 .push_other(V::SIGNATURE)
2869 .push_slice(b")");
2870}
2871impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
2872 MapChangedEventHandler<K, V>
2873{
2874 pub fn new<
2875 F: Fn(
2876 windows_core::Ref<IObservableMap<K, V>>,
2877 windows_core::Ref<IMapChangedEventArgs<K>>,
2878 ) -> windows_core::Result<()>
2879 + Send
2880 + 'static,
2881 >(
2882 invoke: F,
2883 ) -> Self {
2884 let com = windows_core::imp::DelegateBox::<Self, F>::new(
2885 &MapChangedEventHandlerBox::<K, V, F>::VTABLE,
2886 invoke,
2887 );
2888 unsafe { core::mem::transmute(windows_core::imp::box_new(com)) }
2889 }
2890 pub fn Invoke<P0, P1>(&self, sender: P0, event: P1) -> windows_core::Result<()>
2891 where
2892 P0: windows_core::Param<IObservableMap<K, V>>,
2893 P1: windows_core::Param<IMapChangedEventArgs<K>>,
2894 {
2895 unsafe {
2896 (windows_core::Interface::vtable(self).Invoke)(
2897 windows_core::Interface::as_raw(self),
2898 sender.param().abi(),
2899 event.param().abi(),
2900 )
2901 .ok()
2902 }
2903 }
2904}
2905#[repr(C)]
2906pub struct MapChangedEventHandler_Vtbl<K, V>
2907where
2908 K: windows_core::RuntimeType + 'static,
2909 V: windows_core::RuntimeType + 'static,
2910{
2911 base__: windows_core::IUnknown_Vtbl,
2912 Invoke: unsafe extern "system" fn(
2913 this: *mut core::ffi::c_void,
2914 sender: *mut core::ffi::c_void,
2915 event: *mut core::ffi::c_void,
2916 ) -> windows_core::HRESULT,
2917 K: core::marker::PhantomData<K>,
2918 V: core::marker::PhantomData<V>,
2919}
2920struct MapChangedEventHandlerBox<
2921 K,
2922 V,
2923 F: Fn(
2924 windows_core::Ref<IObservableMap<K, V>>,
2925 windows_core::Ref<IMapChangedEventArgs<K>>,
2926 ) -> windows_core::Result<()>
2927 + Send
2928 + 'static,
2929>(core::marker::PhantomData<(K, V, fn() -> F)>)
2930where
2931 K: windows_core::RuntimeType + 'static,
2932 V: windows_core::RuntimeType + 'static;
2933impl<
2934 K: windows_core::RuntimeType + 'static,
2935 V: windows_core::RuntimeType + 'static,
2936 F: Fn(
2937 windows_core::Ref<IObservableMap<K, V>>,
2938 windows_core::Ref<IMapChangedEventArgs<K>>,
2939 ) -> windows_core::Result<()>
2940 + Send
2941 + 'static,
2942> MapChangedEventHandlerBox<K, V, F>
2943{
2944 const VTABLE: MapChangedEventHandler_Vtbl<K, V> = MapChangedEventHandler_Vtbl::<K, V> {
2945 base__: windows_core::IUnknown_Vtbl {
2946 QueryInterface:
2947 windows_core::imp::DelegateBox::<MapChangedEventHandler<K, V>, F>::QueryInterface,
2948 AddRef: windows_core::imp::DelegateBox::<MapChangedEventHandler<K, V>, F>::AddRef,
2949 Release: windows_core::imp::DelegateBox::<MapChangedEventHandler<K, V>, F>::Release,
2950 },
2951 Invoke: Self::Invoke,
2952 K: core::marker::PhantomData::<K>,
2953 V: core::marker::PhantomData::<V>,
2954 };
2955 unsafe extern "system" fn Invoke(
2956 this: *mut core::ffi::c_void,
2957 sender: *mut core::ffi::c_void,
2958 event: *mut core::ffi::c_void,
2959 ) -> windows_core::HRESULT {
2960 unsafe {
2961 let this = &mut *(this as *mut *mut core::ffi::c_void
2962 as *mut windows_core::imp::DelegateBox<MapChangedEventHandler<K, V>, F>);
2963 (this.invoke)(
2964 core::mem::transmute_copy(&sender),
2965 core::mem::transmute_copy(&event),
2966 )
2967 .into()
2968 }
2969 }
2970}
2971#[repr(transparent)]
2972#[derive(Clone, Debug, Eq, PartialEq)]
2973pub struct VectorChangedEventHandler<T>(windows_core::IUnknown, core::marker::PhantomData<T>)
2974where
2975 T: windows_core::RuntimeType + 'static;
2976unsafe impl<T: windows_core::RuntimeType + 'static> windows_core::Interface
2977 for VectorChangedEventHandler<T>
2978{
2979 type Vtable = VectorChangedEventHandler_Vtbl<T>;
2980 const IID: windows_core::GUID =
2981 windows_core::GUID::from_signature(<Self as windows_core::RuntimeType>::SIGNATURE);
2982}
2983impl<T: windows_core::RuntimeType + 'static> windows_core::RuntimeType
2984 for VectorChangedEventHandler<T>
2985{
2986 const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new()
2987 .push_slice(b"pinterface({0c051752-9fbf-4c70-aa0c-0e4c82d9a761}")
2988 .push_slice(b";")
2989 .push_other(T::SIGNATURE)
2990 .push_slice(b")");
2991}
2992impl<T: windows_core::RuntimeType + 'static> VectorChangedEventHandler<T> {
2993 pub fn new<
2994 F: Fn(
2995 windows_core::Ref<IObservableVector<T>>,
2996 windows_core::Ref<IVectorChangedEventArgs>,
2997 ) -> windows_core::Result<()>
2998 + Send
2999 + 'static,
3000 >(
3001 invoke: F,
3002 ) -> Self {
3003 let com = windows_core::imp::DelegateBox::<Self, F>::new(
3004 &VectorChangedEventHandlerBox::<T, F>::VTABLE,
3005 invoke,
3006 );
3007 unsafe { core::mem::transmute(windows_core::imp::box_new(com)) }
3008 }
3009 pub fn Invoke<P0, P1>(&self, sender: P0, event: P1) -> windows_core::Result<()>
3010 where
3011 P0: windows_core::Param<IObservableVector<T>>,
3012 P1: windows_core::Param<IVectorChangedEventArgs>,
3013 {
3014 unsafe {
3015 (windows_core::Interface::vtable(self).Invoke)(
3016 windows_core::Interface::as_raw(self),
3017 sender.param().abi(),
3018 event.param().abi(),
3019 )
3020 .ok()
3021 }
3022 }
3023}
3024#[repr(C)]
3025pub struct VectorChangedEventHandler_Vtbl<T>
3026where
3027 T: windows_core::RuntimeType + 'static,
3028{
3029 base__: windows_core::IUnknown_Vtbl,
3030 Invoke: unsafe extern "system" fn(
3031 this: *mut core::ffi::c_void,
3032 sender: *mut core::ffi::c_void,
3033 event: *mut core::ffi::c_void,
3034 ) -> windows_core::HRESULT,
3035 T: core::marker::PhantomData<T>,
3036}
3037struct VectorChangedEventHandlerBox<
3038 T,
3039 F: Fn(
3040 windows_core::Ref<IObservableVector<T>>,
3041 windows_core::Ref<IVectorChangedEventArgs>,
3042 ) -> windows_core::Result<()>
3043 + Send
3044 + 'static,
3045>(core::marker::PhantomData<(T, fn() -> F)>)
3046where
3047 T: windows_core::RuntimeType + 'static;
3048impl<
3049 T: windows_core::RuntimeType + 'static,
3050 F: Fn(
3051 windows_core::Ref<IObservableVector<T>>,
3052 windows_core::Ref<IVectorChangedEventArgs>,
3053 ) -> windows_core::Result<()>
3054 + Send
3055 + 'static,
3056> VectorChangedEventHandlerBox<T, F>
3057{
3058 const VTABLE: VectorChangedEventHandler_Vtbl<T> = VectorChangedEventHandler_Vtbl::<T> {
3059 base__: windows_core::IUnknown_Vtbl {
3060 QueryInterface:
3061 windows_core::imp::DelegateBox::<VectorChangedEventHandler<T>, F>::QueryInterface,
3062 AddRef: windows_core::imp::DelegateBox::<VectorChangedEventHandler<T>, F>::AddRef,
3063 Release: windows_core::imp::DelegateBox::<VectorChangedEventHandler<T>, F>::Release,
3064 },
3065 Invoke: Self::Invoke,
3066 T: core::marker::PhantomData::<T>,
3067 };
3068 unsafe extern "system" fn Invoke(
3069 this: *mut core::ffi::c_void,
3070 sender: *mut core::ffi::c_void,
3071 event: *mut core::ffi::c_void,
3072 ) -> windows_core::HRESULT {
3073 unsafe {
3074 let this = &mut *(this as *mut *mut core::ffi::c_void
3075 as *mut windows_core::imp::DelegateBox<VectorChangedEventHandler<T>, F>);
3076 (this.invoke)(
3077 core::mem::transmute_copy(&sender),
3078 core::mem::transmute_copy(&event),
3079 )
3080 .into()
3081 }
3082 }
3083}