windows_future/
bindings.rs

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