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