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