-
Notifications
You must be signed in to change notification settings - Fork 613
Expand file tree
/
Copy pathmod.rs
More file actions
5312 lines (5312 loc) · 310 KB
/
mod.rs
File metadata and controls
5312 lines (5312 loc) · 310 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#[repr(transparent)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ActivitySensorTrigger(windows_core::IUnknown);
windows_core::imp::interface_hierarchy!(ActivitySensorTrigger, windows_core::IUnknown, windows_core::IInspectable);
windows_core::imp::required_hierarchy!(ActivitySensorTrigger, IBackgroundTrigger);
impl ActivitySensorTrigger {
#[cfg(feature = "Devices_Sensors")]
pub fn SubscribedActivities(&self) -> windows_core::Result<windows_collections::IVector<super::super::Devices::Sensors::ActivityType>> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).SubscribedActivities)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
}
}
pub fn ReportInterval(&self) -> windows_core::Result<u32> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).ReportInterval)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
}
}
#[cfg(feature = "Devices_Sensors")]
pub fn SupportedActivities(&self) -> windows_core::Result<windows_collections::IVectorView<super::super::Devices::Sensors::ActivityType>> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).SupportedActivities)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
}
}
pub fn MinimumReportInterval(&self) -> windows_core::Result<u32> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).MinimumReportInterval)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
}
}
pub fn Create(reportintervalinmilliseconds: u32) -> windows_core::Result<ActivitySensorTrigger> {
Self::IActivitySensorTriggerFactory(|this| unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).Create)(windows_core::Interface::as_raw(this), reportintervalinmilliseconds, &mut result__).and_then(|| windows_core::Type::from_abi(result__))
})
}
fn IActivitySensorTriggerFactory<R, F: FnOnce(&IActivitySensorTriggerFactory) -> windows_core::Result<R>>(callback: F) -> windows_core::Result<R> {
static SHARED: windows_core::imp::FactoryCache<ActivitySensorTrigger, IActivitySensorTriggerFactory> = windows_core::imp::FactoryCache::new();
SHARED.call(callback)
}
}
impl windows_core::RuntimeType for ActivitySensorTrigger {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_class::<Self, IActivitySensorTrigger>();
}
unsafe impl windows_core::Interface for ActivitySensorTrigger {
type Vtable = <IActivitySensorTrigger as windows_core::Interface>::Vtable;
const IID: windows_core::GUID = <IActivitySensorTrigger as windows_core::Interface>::IID;
}
impl windows_core::RuntimeName for ActivitySensorTrigger {
const NAME: &'static str = "Windows.ApplicationModel.Background.ActivitySensorTrigger";
}
unsafe impl Send for ActivitySensorTrigger {}
unsafe impl Sync for ActivitySensorTrigger {}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub struct AlarmAccessStatus(pub i32);
impl AlarmAccessStatus {
pub const Unspecified: Self = Self(0i32);
pub const AllowedWithWakeupCapability: Self = Self(1i32);
pub const AllowedWithoutWakeupCapability: Self = Self(2i32);
pub const Denied: Self = Self(3i32);
}
impl windows_core::TypeKind for AlarmAccessStatus {
type TypeKind = windows_core::CopyType;
}
impl windows_core::RuntimeType for AlarmAccessStatus {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.AlarmAccessStatus;i4)");
}
pub struct AlarmApplicationManager;
impl AlarmApplicationManager {
pub fn RequestAccessAsync() -> windows_core::Result<windows_future::IAsyncOperation<AlarmAccessStatus>> {
Self::IAlarmApplicationManagerStatics(|this| unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).RequestAccessAsync)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
})
}
pub fn GetAccessStatus() -> windows_core::Result<AlarmAccessStatus> {
Self::IAlarmApplicationManagerStatics(|this| unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).GetAccessStatus)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
})
}
fn IAlarmApplicationManagerStatics<R, F: FnOnce(&IAlarmApplicationManagerStatics) -> windows_core::Result<R>>(callback: F) -> windows_core::Result<R> {
static SHARED: windows_core::imp::FactoryCache<AlarmApplicationManager, IAlarmApplicationManagerStatics> = windows_core::imp::FactoryCache::new();
SHARED.call(callback)
}
}
impl windows_core::RuntimeName for AlarmApplicationManager {
const NAME: &'static str = "Windows.ApplicationModel.Background.AlarmApplicationManager";
}
#[repr(transparent)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct AppBroadcastTrigger(windows_core::IUnknown);
windows_core::imp::interface_hierarchy!(AppBroadcastTrigger, windows_core::IUnknown, windows_core::IInspectable);
windows_core::imp::required_hierarchy!(AppBroadcastTrigger, IBackgroundTrigger);
impl AppBroadcastTrigger {
pub fn SetProviderInfo<P0>(&self, value: P0) -> windows_core::Result<()>
where
P0: windows_core::Param<AppBroadcastTriggerProviderInfo>,
{
let this = self;
unsafe { (windows_core::Interface::vtable(this).SetProviderInfo)(windows_core::Interface::as_raw(this), value.param().abi()).ok() }
}
pub fn ProviderInfo(&self) -> windows_core::Result<AppBroadcastTriggerProviderInfo> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).ProviderInfo)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
}
}
pub fn CreateAppBroadcastTrigger(providerkey: &windows_core::HSTRING) -> windows_core::Result<AppBroadcastTrigger> {
Self::IAppBroadcastTriggerFactory(|this| unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).CreateAppBroadcastTrigger)(windows_core::Interface::as_raw(this), core::mem::transmute_copy(providerkey), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
})
}
fn IAppBroadcastTriggerFactory<R, F: FnOnce(&IAppBroadcastTriggerFactory) -> windows_core::Result<R>>(callback: F) -> windows_core::Result<R> {
static SHARED: windows_core::imp::FactoryCache<AppBroadcastTrigger, IAppBroadcastTriggerFactory> = windows_core::imp::FactoryCache::new();
SHARED.call(callback)
}
}
impl windows_core::RuntimeType for AppBroadcastTrigger {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_class::<Self, IAppBroadcastTrigger>();
}
unsafe impl windows_core::Interface for AppBroadcastTrigger {
type Vtable = <IAppBroadcastTrigger as windows_core::Interface>::Vtable;
const IID: windows_core::GUID = <IAppBroadcastTrigger as windows_core::Interface>::IID;
}
impl windows_core::RuntimeName for AppBroadcastTrigger {
const NAME: &'static str = "Windows.ApplicationModel.Background.AppBroadcastTrigger";
}
unsafe impl Send for AppBroadcastTrigger {}
unsafe impl Sync for AppBroadcastTrigger {}
#[repr(transparent)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct AppBroadcastTriggerProviderInfo(windows_core::IUnknown);
windows_core::imp::interface_hierarchy!(AppBroadcastTriggerProviderInfo, windows_core::IUnknown, windows_core::IInspectable);
impl AppBroadcastTriggerProviderInfo {
pub fn SetDisplayNameResource(&self, value: &windows_core::HSTRING) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).SetDisplayNameResource)(windows_core::Interface::as_raw(this), core::mem::transmute_copy(value)).ok() }
}
pub fn DisplayNameResource(&self) -> windows_core::Result<windows_core::HSTRING> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).DisplayNameResource)(windows_core::Interface::as_raw(this), &mut result__).map(|| core::mem::transmute(result__))
}
}
pub fn SetLogoResource(&self, value: &windows_core::HSTRING) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).SetLogoResource)(windows_core::Interface::as_raw(this), core::mem::transmute_copy(value)).ok() }
}
pub fn LogoResource(&self) -> windows_core::Result<windows_core::HSTRING> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).LogoResource)(windows_core::Interface::as_raw(this), &mut result__).map(|| core::mem::transmute(result__))
}
}
pub fn SetVideoKeyFrameInterval(&self, value: super::super::Foundation::TimeSpan) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).SetVideoKeyFrameInterval)(windows_core::Interface::as_raw(this), value).ok() }
}
pub fn VideoKeyFrameInterval(&self) -> windows_core::Result<super::super::Foundation::TimeSpan> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).VideoKeyFrameInterval)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
}
}
pub fn SetMaxVideoBitrate(&self, value: u32) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).SetMaxVideoBitrate)(windows_core::Interface::as_raw(this), value).ok() }
}
pub fn MaxVideoBitrate(&self) -> windows_core::Result<u32> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).MaxVideoBitrate)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
}
}
pub fn SetMaxVideoWidth(&self, value: u32) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).SetMaxVideoWidth)(windows_core::Interface::as_raw(this), value).ok() }
}
pub fn MaxVideoWidth(&self) -> windows_core::Result<u32> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).MaxVideoWidth)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
}
}
pub fn SetMaxVideoHeight(&self, value: u32) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).SetMaxVideoHeight)(windows_core::Interface::as_raw(this), value).ok() }
}
pub fn MaxVideoHeight(&self) -> windows_core::Result<u32> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).MaxVideoHeight)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
}
}
}
impl windows_core::RuntimeType for AppBroadcastTriggerProviderInfo {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_class::<Self, IAppBroadcastTriggerProviderInfo>();
}
unsafe impl windows_core::Interface for AppBroadcastTriggerProviderInfo {
type Vtable = <IAppBroadcastTriggerProviderInfo as windows_core::Interface>::Vtable;
const IID: windows_core::GUID = <IAppBroadcastTriggerProviderInfo as windows_core::Interface>::IID;
}
impl windows_core::RuntimeName for AppBroadcastTriggerProviderInfo {
const NAME: &'static str = "Windows.ApplicationModel.Background.AppBroadcastTriggerProviderInfo";
}
unsafe impl Send for AppBroadcastTriggerProviderInfo {}
unsafe impl Sync for AppBroadcastTriggerProviderInfo {}
#[repr(transparent)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ApplicationTrigger(windows_core::IUnknown);
windows_core::imp::interface_hierarchy!(ApplicationTrigger, windows_core::IUnknown, windows_core::IInspectable);
windows_core::imp::required_hierarchy!(ApplicationTrigger, IBackgroundTrigger);
impl ApplicationTrigger {
pub fn new() -> windows_core::Result<Self> {
Self::IActivationFactory(|f| f.ActivateInstance::<Self>())
}
fn IActivationFactory<R, F: FnOnce(&windows_core::imp::IGenericFactory) -> windows_core::Result<R>>(callback: F) -> windows_core::Result<R> {
static SHARED: windows_core::imp::FactoryCache<ApplicationTrigger, windows_core::imp::IGenericFactory> = windows_core::imp::FactoryCache::new();
SHARED.call(callback)
}
pub fn RequestAsync(&self) -> windows_core::Result<windows_future::IAsyncOperation<ApplicationTriggerResult>> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).RequestAsync)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
}
}
#[cfg(feature = "Foundation_Collections")]
pub fn RequestAsyncWithArguments<P0>(&self, arguments: P0) -> windows_core::Result<windows_future::IAsyncOperation<ApplicationTriggerResult>>
where
P0: windows_core::Param<super::super::Foundation::Collections::ValueSet>,
{
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).RequestAsyncWithArguments)(windows_core::Interface::as_raw(this), arguments.param().abi(), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
}
}
}
impl windows_core::RuntimeType for ApplicationTrigger {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_class::<Self, IApplicationTrigger>();
}
unsafe impl windows_core::Interface for ApplicationTrigger {
type Vtable = <IApplicationTrigger as windows_core::Interface>::Vtable;
const IID: windows_core::GUID = <IApplicationTrigger as windows_core::Interface>::IID;
}
impl windows_core::RuntimeName for ApplicationTrigger {
const NAME: &'static str = "Windows.ApplicationModel.Background.ApplicationTrigger";
}
unsafe impl Send for ApplicationTrigger {}
unsafe impl Sync for ApplicationTrigger {}
#[repr(transparent)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ApplicationTriggerDetails(windows_core::IUnknown);
windows_core::imp::interface_hierarchy!(ApplicationTriggerDetails, windows_core::IUnknown, windows_core::IInspectable);
impl ApplicationTriggerDetails {
#[cfg(feature = "Foundation_Collections")]
pub fn Arguments(&self) -> windows_core::Result<super::super::Foundation::Collections::ValueSet> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).Arguments)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
}
}
}
impl windows_core::RuntimeType for ApplicationTriggerDetails {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_class::<Self, IApplicationTriggerDetails>();
}
unsafe impl windows_core::Interface for ApplicationTriggerDetails {
type Vtable = <IApplicationTriggerDetails as windows_core::Interface>::Vtable;
const IID: windows_core::GUID = <IApplicationTriggerDetails as windows_core::Interface>::IID;
}
impl windows_core::RuntimeName for ApplicationTriggerDetails {
const NAME: &'static str = "Windows.ApplicationModel.Background.ApplicationTriggerDetails";
}
unsafe impl Send for ApplicationTriggerDetails {}
unsafe impl Sync for ApplicationTriggerDetails {}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub struct ApplicationTriggerResult(pub i32);
impl ApplicationTriggerResult {
pub const Allowed: Self = Self(0i32);
pub const CurrentlyRunning: Self = Self(1i32);
pub const DisabledByPolicy: Self = Self(2i32);
pub const UnknownError: Self = Self(3i32);
}
impl windows_core::TypeKind for ApplicationTriggerResult {
type TypeKind = windows_core::CopyType;
}
impl windows_core::RuntimeType for ApplicationTriggerResult {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.ApplicationTriggerResult;i4)");
}
#[repr(transparent)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct AppointmentStoreNotificationTrigger(windows_core::IUnknown);
windows_core::imp::interface_hierarchy!(AppointmentStoreNotificationTrigger, windows_core::IUnknown, windows_core::IInspectable);
windows_core::imp::required_hierarchy!(AppointmentStoreNotificationTrigger, IBackgroundTrigger);
impl AppointmentStoreNotificationTrigger {
pub fn new() -> windows_core::Result<Self> {
Self::IActivationFactory(|f| f.ActivateInstance::<Self>())
}
fn IActivationFactory<R, F: FnOnce(&windows_core::imp::IGenericFactory) -> windows_core::Result<R>>(callback: F) -> windows_core::Result<R> {
static SHARED: windows_core::imp::FactoryCache<AppointmentStoreNotificationTrigger, windows_core::imp::IGenericFactory> = windows_core::imp::FactoryCache::new();
SHARED.call(callback)
}
}
impl windows_core::RuntimeType for AppointmentStoreNotificationTrigger {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_class::<Self, IAppointmentStoreNotificationTrigger>();
}
unsafe impl windows_core::Interface for AppointmentStoreNotificationTrigger {
type Vtable = <IAppointmentStoreNotificationTrigger as windows_core::Interface>::Vtable;
const IID: windows_core::GUID = <IAppointmentStoreNotificationTrigger as windows_core::Interface>::IID;
}
impl windows_core::RuntimeName for AppointmentStoreNotificationTrigger {
const NAME: &'static str = "Windows.ApplicationModel.Background.AppointmentStoreNotificationTrigger";
}
unsafe impl Send for AppointmentStoreNotificationTrigger {}
unsafe impl Sync for AppointmentStoreNotificationTrigger {}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub struct BackgroundAccessRequestKind(pub i32);
impl BackgroundAccessRequestKind {
pub const AlwaysAllowed: Self = Self(0i32);
pub const AllowedSubjectToSystemPolicy: Self = Self(1i32);
}
impl windows_core::TypeKind for BackgroundAccessRequestKind {
type TypeKind = windows_core::CopyType;
}
impl windows_core::RuntimeType for BackgroundAccessRequestKind {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.BackgroundAccessRequestKind;i4)");
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub struct BackgroundAccessStatus(pub i32);
impl BackgroundAccessStatus {
pub const Unspecified: Self = Self(0i32);
pub const AllowedWithAlwaysOnRealTimeConnectivity: Self = Self(1i32);
pub const AllowedMayUseActiveRealTimeConnectivity: Self = Self(2i32);
pub const Denied: Self = Self(3i32);
pub const AlwaysAllowed: Self = Self(4i32);
pub const AllowedSubjectToSystemPolicy: Self = Self(5i32);
pub const DeniedBySystemPolicy: Self = Self(6i32);
pub const DeniedByUser: Self = Self(7i32);
}
impl windows_core::TypeKind for BackgroundAccessStatus {
type TypeKind = windows_core::CopyType;
}
impl windows_core::RuntimeType for BackgroundAccessStatus {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.BackgroundAccessStatus;i4)");
}
pub struct BackgroundExecutionManager;
impl BackgroundExecutionManager {
pub fn RequestAccessAsync() -> windows_core::Result<windows_future::IAsyncOperation<BackgroundAccessStatus>> {
Self::IBackgroundExecutionManagerStatics(|this| unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).RequestAccessAsync)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
})
}
pub fn RequestAccessForApplicationAsync(applicationid: &windows_core::HSTRING) -> windows_core::Result<windows_future::IAsyncOperation<BackgroundAccessStatus>> {
Self::IBackgroundExecutionManagerStatics(|this| unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).RequestAccessForApplicationAsync)(windows_core::Interface::as_raw(this), core::mem::transmute_copy(applicationid), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
})
}
pub fn RemoveAccess() -> windows_core::Result<()> {
Self::IBackgroundExecutionManagerStatics(|this| unsafe { (windows_core::Interface::vtable(this).RemoveAccess)(windows_core::Interface::as_raw(this)).ok() })
}
pub fn RemoveAccessForApplication(applicationid: &windows_core::HSTRING) -> windows_core::Result<()> {
Self::IBackgroundExecutionManagerStatics(|this| unsafe { (windows_core::Interface::vtable(this).RemoveAccessForApplication)(windows_core::Interface::as_raw(this), core::mem::transmute_copy(applicationid)).ok() })
}
pub fn GetAccessStatus() -> windows_core::Result<BackgroundAccessStatus> {
Self::IBackgroundExecutionManagerStatics(|this| unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).GetAccessStatus)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
})
}
pub fn GetAccessStatusForApplication(applicationid: &windows_core::HSTRING) -> windows_core::Result<BackgroundAccessStatus> {
Self::IBackgroundExecutionManagerStatics(|this| unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).GetAccessStatusForApplication)(windows_core::Interface::as_raw(this), core::mem::transmute_copy(applicationid), &mut result__).map(|| result__)
})
}
pub fn RequestAccessKindAsync(requestedaccess: BackgroundAccessRequestKind, reason: &windows_core::HSTRING) -> windows_core::Result<windows_future::IAsyncOperation<bool>> {
Self::IBackgroundExecutionManagerStatics2(|this| unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).RequestAccessKindAsync)(windows_core::Interface::as_raw(this), requestedaccess, core::mem::transmute_copy(reason), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
})
}
pub fn RequestAccessKindForModernStandbyAsync(requestedaccess: BackgroundAccessRequestKind, reason: &windows_core::HSTRING) -> windows_core::Result<windows_future::IAsyncOperation<bool>> {
Self::IBackgroundExecutionManagerStatics3(|this| unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).RequestAccessKindForModernStandbyAsync)(windows_core::Interface::as_raw(this), requestedaccess, core::mem::transmute_copy(reason), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
})
}
pub fn GetAccessStatusForModernStandby() -> windows_core::Result<BackgroundAccessStatus> {
Self::IBackgroundExecutionManagerStatics3(|this| unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).GetAccessStatusForModernStandby)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
})
}
pub fn GetAccessStatusForModernStandbyForApplication(applicationid: &windows_core::HSTRING) -> windows_core::Result<BackgroundAccessStatus> {
Self::IBackgroundExecutionManagerStatics3(|this| unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).GetAccessStatusForModernStandbyForApplication)(windows_core::Interface::as_raw(this), core::mem::transmute_copy(applicationid), &mut result__).map(|| result__)
})
}
fn IBackgroundExecutionManagerStatics<R, F: FnOnce(&IBackgroundExecutionManagerStatics) -> windows_core::Result<R>>(callback: F) -> windows_core::Result<R> {
static SHARED: windows_core::imp::FactoryCache<BackgroundExecutionManager, IBackgroundExecutionManagerStatics> = windows_core::imp::FactoryCache::new();
SHARED.call(callback)
}
fn IBackgroundExecutionManagerStatics2<R, F: FnOnce(&IBackgroundExecutionManagerStatics2) -> windows_core::Result<R>>(callback: F) -> windows_core::Result<R> {
static SHARED: windows_core::imp::FactoryCache<BackgroundExecutionManager, IBackgroundExecutionManagerStatics2> = windows_core::imp::FactoryCache::new();
SHARED.call(callback)
}
fn IBackgroundExecutionManagerStatics3<R, F: FnOnce(&IBackgroundExecutionManagerStatics3) -> windows_core::Result<R>>(callback: F) -> windows_core::Result<R> {
static SHARED: windows_core::imp::FactoryCache<BackgroundExecutionManager, IBackgroundExecutionManagerStatics3> = windows_core::imp::FactoryCache::new();
SHARED.call(callback)
}
}
impl windows_core::RuntimeName for BackgroundExecutionManager {
const NAME: &'static str = "Windows.ApplicationModel.Background.BackgroundExecutionManager";
}
#[repr(transparent)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct BackgroundTaskBuilder(windows_core::IUnknown);
windows_core::imp::interface_hierarchy!(BackgroundTaskBuilder, windows_core::IUnknown, windows_core::IInspectable);
impl BackgroundTaskBuilder {
pub fn new() -> windows_core::Result<Self> {
Self::IActivationFactory(|f| f.ActivateInstance::<Self>())
}
fn IActivationFactory<R, F: FnOnce(&windows_core::imp::IGenericFactory) -> windows_core::Result<R>>(callback: F) -> windows_core::Result<R> {
static SHARED: windows_core::imp::FactoryCache<BackgroundTaskBuilder, windows_core::imp::IGenericFactory> = windows_core::imp::FactoryCache::new();
SHARED.call(callback)
}
pub fn SetTaskEntryPoint(&self, value: &windows_core::HSTRING) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).SetTaskEntryPoint)(windows_core::Interface::as_raw(this), core::mem::transmute_copy(value)).ok() }
}
pub fn TaskEntryPoint(&self) -> windows_core::Result<windows_core::HSTRING> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).TaskEntryPoint)(windows_core::Interface::as_raw(this), &mut result__).map(|| core::mem::transmute(result__))
}
}
pub fn SetTrigger<P0>(&self, trigger: P0) -> windows_core::Result<()>
where
P0: windows_core::Param<IBackgroundTrigger>,
{
let this = self;
unsafe { (windows_core::Interface::vtable(this).SetTrigger)(windows_core::Interface::as_raw(this), trigger.param().abi()).ok() }
}
pub fn AddCondition<P0>(&self, condition: P0) -> windows_core::Result<()>
where
P0: windows_core::Param<IBackgroundCondition>,
{
let this = self;
unsafe { (windows_core::Interface::vtable(this).AddCondition)(windows_core::Interface::as_raw(this), condition.param().abi()).ok() }
}
pub fn SetName(&self, value: &windows_core::HSTRING) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).SetName)(windows_core::Interface::as_raw(this), core::mem::transmute_copy(value)).ok() }
}
pub fn Name(&self) -> windows_core::Result<windows_core::HSTRING> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).Name)(windows_core::Interface::as_raw(this), &mut result__).map(|| core::mem::transmute(result__))
}
}
pub fn Register(&self) -> windows_core::Result<BackgroundTaskRegistration> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).Register)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
}
}
pub fn SetCancelOnConditionLoss(&self, value: bool) -> windows_core::Result<()> {
let this = &windows_core::Interface::cast::<IBackgroundTaskBuilder2>(self)?;
unsafe { (windows_core::Interface::vtable(this).SetCancelOnConditionLoss)(windows_core::Interface::as_raw(this), value).ok() }
}
pub fn CancelOnConditionLoss(&self) -> windows_core::Result<bool> {
let this = &windows_core::Interface::cast::<IBackgroundTaskBuilder2>(self)?;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).CancelOnConditionLoss)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
}
}
pub fn SetIsNetworkRequested(&self, value: bool) -> windows_core::Result<()> {
let this = &windows_core::Interface::cast::<IBackgroundTaskBuilder3>(self)?;
unsafe { (windows_core::Interface::vtable(this).SetIsNetworkRequested)(windows_core::Interface::as_raw(this), value).ok() }
}
pub fn IsNetworkRequested(&self) -> windows_core::Result<bool> {
let this = &windows_core::Interface::cast::<IBackgroundTaskBuilder3>(self)?;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).IsNetworkRequested)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
}
}
pub fn TaskGroup(&self) -> windows_core::Result<BackgroundTaskRegistrationGroup> {
let this = &windows_core::Interface::cast::<IBackgroundTaskBuilder4>(self)?;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).TaskGroup)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
}
}
pub fn SetTaskGroup<P0>(&self, value: P0) -> windows_core::Result<()>
where
P0: windows_core::Param<BackgroundTaskRegistrationGroup>,
{
let this = &windows_core::Interface::cast::<IBackgroundTaskBuilder4>(self)?;
unsafe { (windows_core::Interface::vtable(this).SetTaskGroup)(windows_core::Interface::as_raw(this), value.param().abi()).ok() }
}
pub fn SetTaskEntryPointClsid(&self, taskentrypoint: windows_core::GUID) -> windows_core::Result<()> {
let this = &windows_core::Interface::cast::<IBackgroundTaskBuilder5>(self)?;
unsafe { (windows_core::Interface::vtable(this).SetTaskEntryPointClsid)(windows_core::Interface::as_raw(this), taskentrypoint).ok() }
}
pub fn AllowRunningTaskInStandby(&self) -> windows_core::Result<bool> {
let this = &windows_core::Interface::cast::<IBackgroundTaskBuilder6>(self)?;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).AllowRunningTaskInStandby)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
}
}
pub fn SetAllowRunningTaskInStandby(&self, value: bool) -> windows_core::Result<()> {
let this = &windows_core::Interface::cast::<IBackgroundTaskBuilder6>(self)?;
unsafe { (windows_core::Interface::vtable(this).SetAllowRunningTaskInStandby)(windows_core::Interface::as_raw(this), value).ok() }
}
pub fn Validate(&self) -> windows_core::Result<bool> {
let this = &windows_core::Interface::cast::<IBackgroundTaskBuilder6>(self)?;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).Validate)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
}
}
pub fn Register2(&self, taskname: &windows_core::HSTRING) -> windows_core::Result<BackgroundTaskRegistration> {
let this = &windows_core::Interface::cast::<IBackgroundTaskBuilder6>(self)?;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).Register)(windows_core::Interface::as_raw(this), core::mem::transmute_copy(taskname), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
}
}
pub fn IsRunningTaskInStandbySupported() -> windows_core::Result<bool> {
Self::IBackgroundTaskBuilderStatics(|this| unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).IsRunningTaskInStandbySupported)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
})
}
fn IBackgroundTaskBuilderStatics<R, F: FnOnce(&IBackgroundTaskBuilderStatics) -> windows_core::Result<R>>(callback: F) -> windows_core::Result<R> {
static SHARED: windows_core::imp::FactoryCache<BackgroundTaskBuilder, IBackgroundTaskBuilderStatics> = windows_core::imp::FactoryCache::new();
SHARED.call(callback)
}
}
impl windows_core::RuntimeType for BackgroundTaskBuilder {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_class::<Self, IBackgroundTaskBuilder>();
}
unsafe impl windows_core::Interface for BackgroundTaskBuilder {
type Vtable = <IBackgroundTaskBuilder as windows_core::Interface>::Vtable;
const IID: windows_core::GUID = <IBackgroundTaskBuilder as windows_core::Interface>::IID;
}
impl windows_core::RuntimeName for BackgroundTaskBuilder {
const NAME: &'static str = "Windows.ApplicationModel.Background.BackgroundTaskBuilder";
}
windows_core::imp::define_interface!(BackgroundTaskCanceledEventHandler, BackgroundTaskCanceledEventHandler_Vtbl, 0xa6c4bac0_51f8_4c57_ac3f_156dd1680c4f);
impl windows_core::RuntimeType for BackgroundTaskCanceledEventHandler {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_interface::<Self>();
}
impl BackgroundTaskCanceledEventHandler {
pub fn new<F: Fn(windows_core::Ref<IBackgroundTaskInstance>, BackgroundTaskCancellationReason) -> windows_core::Result<()> + Send + 'static>(invoke: F) -> Self {
let com = BackgroundTaskCanceledEventHandlerBox { vtable: &BackgroundTaskCanceledEventHandlerBox::<F>::VTABLE, count: windows_core::imp::RefCount::new(1), invoke };
unsafe { core::mem::transmute(windows_core::imp::Box::new(com)) }
}
pub fn Invoke<P0>(&self, sender: P0, reason: BackgroundTaskCancellationReason) -> windows_core::Result<()>
where
P0: windows_core::Param<IBackgroundTaskInstance>,
{
let this = self;
unsafe { (windows_core::Interface::vtable(this).Invoke)(windows_core::Interface::as_raw(this), sender.param().abi(), reason).ok() }
}
}
#[repr(C)]
#[doc(hidden)]
pub struct BackgroundTaskCanceledEventHandler_Vtbl {
base__: windows_core::IUnknown_Vtbl,
Invoke: unsafe extern "system" fn(this: *mut core::ffi::c_void, sender: *mut core::ffi::c_void, reason: BackgroundTaskCancellationReason) -> windows_core::HRESULT,
}
#[repr(C)]
struct BackgroundTaskCanceledEventHandlerBox<F: Fn(windows_core::Ref<IBackgroundTaskInstance>, BackgroundTaskCancellationReason) -> windows_core::Result<()> + Send + 'static> {
vtable: *const BackgroundTaskCanceledEventHandler_Vtbl,
invoke: F,
count: windows_core::imp::RefCount,
}
impl<F: Fn(windows_core::Ref<IBackgroundTaskInstance>, BackgroundTaskCancellationReason) -> windows_core::Result<()> + Send + 'static> BackgroundTaskCanceledEventHandlerBox<F> {
const VTABLE: BackgroundTaskCanceledEventHandler_Vtbl = BackgroundTaskCanceledEventHandler_Vtbl { base__: windows_core::IUnknown_Vtbl { QueryInterface: Self::QueryInterface, AddRef: Self::AddRef, Release: Self::Release }, Invoke: Self::Invoke };
unsafe extern "system" fn QueryInterface(this: *mut core::ffi::c_void, iid: *const windows_core::GUID, interface: *mut *mut core::ffi::c_void) -> windows_core::HRESULT {
unsafe {
let this = this as *mut *mut core::ffi::c_void as *mut Self;
if iid.is_null() || interface.is_null() {
return windows_core::HRESULT(-2147467261);
}
*interface = if *iid == <BackgroundTaskCanceledEventHandler 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()
};
if (*interface).is_null() {
windows_core::HRESULT(-2147467262)
} else {
(*this).count.add_ref();
windows_core::HRESULT(0)
}
}
}
unsafe extern "system" fn AddRef(this: *mut core::ffi::c_void) -> u32 {
unsafe {
let this = this as *mut *mut core::ffi::c_void as *mut Self;
(*this).count.add_ref()
}
}
unsafe extern "system" fn Release(this: *mut core::ffi::c_void) -> u32 {
unsafe {
let this = this as *mut *mut core::ffi::c_void as *mut Self;
let remaining = (*this).count.release();
if remaining == 0 {
let _ = windows_core::imp::Box::from_raw(this);
}
remaining
}
}
unsafe extern "system" fn Invoke(this: *mut core::ffi::c_void, sender: *mut core::ffi::c_void, reason: BackgroundTaskCancellationReason) -> windows_core::HRESULT {
unsafe {
let this = &mut *(this as *mut *mut core::ffi::c_void as *mut Self);
(this.invoke)(core::mem::transmute_copy(&sender), reason).into()
}
}
}
impl<F: Fn(windows_core::Ref<IBackgroundTaskInstance>, BackgroundTaskCancellationReason) -> windows_core::Result<()> + Send + 'static> From<windows_core::DelegateFn<F>> for BackgroundTaskCanceledEventHandler {
fn from(value: windows_core::DelegateFn<F>) -> Self {
Self::new(value.0)
}
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub struct BackgroundTaskCancellationReason(pub i32);
impl BackgroundTaskCancellationReason {
pub const Abort: Self = Self(0i32);
pub const Terminating: Self = Self(1i32);
pub const LoggingOff: Self = Self(2i32);
pub const ServicingUpdate: Self = Self(3i32);
pub const IdleTask: Self = Self(4i32);
pub const Uninstall: Self = Self(5i32);
pub const ConditionLoss: Self = Self(6i32);
pub const SystemPolicy: Self = Self(7i32);
pub const QuietHoursEntered: Self = Self(8i32);
pub const ExecutionTimeExceeded: Self = Self(9i32);
pub const ResourceRevocation: Self = Self(10i32);
pub const EnergySaver: Self = Self(11i32);
}
impl windows_core::TypeKind for BackgroundTaskCancellationReason {
type TypeKind = windows_core::CopyType;
}
impl windows_core::RuntimeType for BackgroundTaskCancellationReason {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.BackgroundTaskCancellationReason;i4)");
}
#[repr(transparent)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct BackgroundTaskCompletedEventArgs(windows_core::IUnknown);
windows_core::imp::interface_hierarchy!(BackgroundTaskCompletedEventArgs, windows_core::IUnknown, windows_core::IInspectable);
impl BackgroundTaskCompletedEventArgs {
pub fn InstanceId(&self) -> windows_core::Result<windows_core::GUID> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).InstanceId)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
}
}
pub fn CheckResult(&self) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).CheckResult)(windows_core::Interface::as_raw(this)).ok() }
}
}
impl windows_core::RuntimeType for BackgroundTaskCompletedEventArgs {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_class::<Self, IBackgroundTaskCompletedEventArgs>();
}
unsafe impl windows_core::Interface for BackgroundTaskCompletedEventArgs {
type Vtable = <IBackgroundTaskCompletedEventArgs as windows_core::Interface>::Vtable;
const IID: windows_core::GUID = <IBackgroundTaskCompletedEventArgs as windows_core::Interface>::IID;
}
impl windows_core::RuntimeName for BackgroundTaskCompletedEventArgs {
const NAME: &'static str = "Windows.ApplicationModel.Background.BackgroundTaskCompletedEventArgs";
}
unsafe impl Send for BackgroundTaskCompletedEventArgs {}
unsafe impl Sync for BackgroundTaskCompletedEventArgs {}
windows_core::imp::define_interface!(BackgroundTaskCompletedEventHandler, BackgroundTaskCompletedEventHandler_Vtbl, 0x5b38e929_a086_46a7_a678_439135822bcf);
impl windows_core::RuntimeType for BackgroundTaskCompletedEventHandler {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_interface::<Self>();
}
impl BackgroundTaskCompletedEventHandler {
pub fn new<F: Fn(windows_core::Ref<BackgroundTaskRegistration>, windows_core::Ref<BackgroundTaskCompletedEventArgs>) -> windows_core::Result<()> + Send + 'static>(invoke: F) -> Self {
let com = BackgroundTaskCompletedEventHandlerBox { vtable: &BackgroundTaskCompletedEventHandlerBox::<F>::VTABLE, count: windows_core::imp::RefCount::new(1), invoke };
unsafe { core::mem::transmute(windows_core::imp::Box::new(com)) }
}
pub fn Invoke<P0, P1>(&self, sender: P0, args: P1) -> windows_core::Result<()>
where
P0: windows_core::Param<BackgroundTaskRegistration>,
P1: windows_core::Param<BackgroundTaskCompletedEventArgs>,
{
let this = self;
unsafe { (windows_core::Interface::vtable(this).Invoke)(windows_core::Interface::as_raw(this), sender.param().abi(), args.param().abi()).ok() }
}
}
#[repr(C)]
#[doc(hidden)]
pub struct BackgroundTaskCompletedEventHandler_Vtbl {
base__: windows_core::IUnknown_Vtbl,
Invoke: unsafe extern "system" fn(this: *mut core::ffi::c_void, sender: *mut core::ffi::c_void, args: *mut core::ffi::c_void) -> windows_core::HRESULT,
}
#[repr(C)]
struct BackgroundTaskCompletedEventHandlerBox<F: Fn(windows_core::Ref<BackgroundTaskRegistration>, windows_core::Ref<BackgroundTaskCompletedEventArgs>) -> windows_core::Result<()> + Send + 'static> {
vtable: *const BackgroundTaskCompletedEventHandler_Vtbl,
invoke: F,
count: windows_core::imp::RefCount,
}
impl<F: Fn(windows_core::Ref<BackgroundTaskRegistration>, windows_core::Ref<BackgroundTaskCompletedEventArgs>) -> windows_core::Result<()> + Send + 'static> BackgroundTaskCompletedEventHandlerBox<F> {
const VTABLE: BackgroundTaskCompletedEventHandler_Vtbl = BackgroundTaskCompletedEventHandler_Vtbl { base__: windows_core::IUnknown_Vtbl { QueryInterface: Self::QueryInterface, AddRef: Self::AddRef, Release: Self::Release }, Invoke: Self::Invoke };
unsafe extern "system" fn QueryInterface(this: *mut core::ffi::c_void, iid: *const windows_core::GUID, interface: *mut *mut core::ffi::c_void) -> windows_core::HRESULT {
unsafe {
let this = this as *mut *mut core::ffi::c_void as *mut Self;
if iid.is_null() || interface.is_null() {
return windows_core::HRESULT(-2147467261);
}
*interface = if *iid == <BackgroundTaskCompletedEventHandler 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()
};
if (*interface).is_null() {
windows_core::HRESULT(-2147467262)
} else {
(*this).count.add_ref();
windows_core::HRESULT(0)
}
}
}
unsafe extern "system" fn AddRef(this: *mut core::ffi::c_void) -> u32 {
unsafe {
let this = this as *mut *mut core::ffi::c_void as *mut Self;
(*this).count.add_ref()
}
}
unsafe extern "system" fn Release(this: *mut core::ffi::c_void) -> u32 {
unsafe {
let this = this as *mut *mut core::ffi::c_void as *mut Self;
let remaining = (*this).count.release();
if remaining == 0 {
let _ = windows_core::imp::Box::from_raw(this);
}
remaining
}
}
unsafe extern "system" fn Invoke(this: *mut core::ffi::c_void, sender: *mut core::ffi::c_void, args: *mut core::ffi::c_void) -> windows_core::HRESULT {
unsafe {
let this = &mut *(this as *mut *mut core::ffi::c_void as *mut Self);
(this.invoke)(core::mem::transmute_copy(&sender), core::mem::transmute_copy(&args)).into()
}
}
}
impl<F: Fn(windows_core::Ref<BackgroundTaskRegistration>, windows_core::Ref<BackgroundTaskCompletedEventArgs>) -> windows_core::Result<()> + Send + 'static> From<windows_core::DelegateFn<F>> for BackgroundTaskCompletedEventHandler {
fn from(value: windows_core::DelegateFn<F>) -> Self {
Self::new(value.0)
}
}
#[repr(transparent)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct BackgroundTaskDeferral(windows_core::IUnknown);
windows_core::imp::interface_hierarchy!(BackgroundTaskDeferral, windows_core::IUnknown, windows_core::IInspectable);
impl BackgroundTaskDeferral {
pub fn Complete(&self) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).Complete)(windows_core::Interface::as_raw(this)).ok() }
}
}
impl windows_core::RuntimeType for BackgroundTaskDeferral {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_class::<Self, IBackgroundTaskDeferral>();
}
unsafe impl windows_core::Interface for BackgroundTaskDeferral {
type Vtable = <IBackgroundTaskDeferral as windows_core::Interface>::Vtable;
const IID: windows_core::GUID = <IBackgroundTaskDeferral as windows_core::Interface>::IID;
}
impl windows_core::RuntimeName for BackgroundTaskDeferral {
const NAME: &'static str = "Windows.ApplicationModel.Background.BackgroundTaskDeferral";
}
unsafe impl Send for BackgroundTaskDeferral {}
unsafe impl Sync for BackgroundTaskDeferral {}
#[repr(transparent)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct BackgroundTaskProgressEventArgs(windows_core::IUnknown);
windows_core::imp::interface_hierarchy!(BackgroundTaskProgressEventArgs, windows_core::IUnknown, windows_core::IInspectable);
impl BackgroundTaskProgressEventArgs {
pub fn InstanceId(&self) -> windows_core::Result<windows_core::GUID> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).InstanceId)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
}
}
pub fn Progress(&self) -> windows_core::Result<u32> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).Progress)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
}
}
}
impl windows_core::RuntimeType for BackgroundTaskProgressEventArgs {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_class::<Self, IBackgroundTaskProgressEventArgs>();
}
unsafe impl windows_core::Interface for BackgroundTaskProgressEventArgs {
type Vtable = <IBackgroundTaskProgressEventArgs as windows_core::Interface>::Vtable;
const IID: windows_core::GUID = <IBackgroundTaskProgressEventArgs as windows_core::Interface>::IID;
}
impl windows_core::RuntimeName for BackgroundTaskProgressEventArgs {
const NAME: &'static str = "Windows.ApplicationModel.Background.BackgroundTaskProgressEventArgs";
}
unsafe impl Send for BackgroundTaskProgressEventArgs {}
unsafe impl Sync for BackgroundTaskProgressEventArgs {}
windows_core::imp::define_interface!(BackgroundTaskProgressEventHandler, BackgroundTaskProgressEventHandler_Vtbl, 0x46e0683c_8a88_4c99_804c_76897f6277a6);
impl windows_core::RuntimeType for BackgroundTaskProgressEventHandler {
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_interface::<Self>();
}
impl BackgroundTaskProgressEventHandler {
pub fn new<F: Fn(windows_core::Ref<BackgroundTaskRegistration>, windows_core::Ref<BackgroundTaskProgressEventArgs>) -> windows_core::Result<()> + Send + 'static>(invoke: F) -> Self {
let com = BackgroundTaskProgressEventHandlerBox { vtable: &BackgroundTaskProgressEventHandlerBox::<F>::VTABLE, count: windows_core::imp::RefCount::new(1), invoke };
unsafe { core::mem::transmute(windows_core::imp::Box::new(com)) }
}
pub fn Invoke<P0, P1>(&self, sender: P0, args: P1) -> windows_core::Result<()>
where
P0: windows_core::Param<BackgroundTaskRegistration>,
P1: windows_core::Param<BackgroundTaskProgressEventArgs>,
{
let this = self;
unsafe { (windows_core::Interface::vtable(this).Invoke)(windows_core::Interface::as_raw(this), sender.param().abi(), args.param().abi()).ok() }
}
}
#[repr(C)]
#[doc(hidden)]
pub struct BackgroundTaskProgressEventHandler_Vtbl {
base__: windows_core::IUnknown_Vtbl,
Invoke: unsafe extern "system" fn(this: *mut core::ffi::c_void, sender: *mut core::ffi::c_void, args: *mut core::ffi::c_void) -> windows_core::HRESULT,
}
#[repr(C)]
struct BackgroundTaskProgressEventHandlerBox<F: Fn(windows_core::Ref<BackgroundTaskRegistration>, windows_core::Ref<BackgroundTaskProgressEventArgs>) -> windows_core::Result<()> + Send + 'static> {
vtable: *const BackgroundTaskProgressEventHandler_Vtbl,
invoke: F,
count: windows_core::imp::RefCount,
}
impl<F: Fn(windows_core::Ref<BackgroundTaskRegistration>, windows_core::Ref<BackgroundTaskProgressEventArgs>) -> windows_core::Result<()> + Send + 'static> BackgroundTaskProgressEventHandlerBox<F> {
const VTABLE: BackgroundTaskProgressEventHandler_Vtbl = BackgroundTaskProgressEventHandler_Vtbl { base__: windows_core::IUnknown_Vtbl { QueryInterface: Self::QueryInterface, AddRef: Self::AddRef, Release: Self::Release }, Invoke: Self::Invoke };
unsafe extern "system" fn QueryInterface(this: *mut core::ffi::c_void, iid: *const windows_core::GUID, interface: *mut *mut core::ffi::c_void) -> windows_core::HRESULT {
unsafe {
let this = this as *mut *mut core::ffi::c_void as *mut Self;
if iid.is_null() || interface.is_null() {
return windows_core::HRESULT(-2147467261);
}
*interface = if *iid == <BackgroundTaskProgressEventHandler 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()
};
if (*interface).is_null() {
windows_core::HRESULT(-2147467262)
} else {
(*this).count.add_ref();
windows_core::HRESULT(0)
}
}
}
unsafe extern "system" fn AddRef(this: *mut core::ffi::c_void) -> u32 {
unsafe {
let this = this as *mut *mut core::ffi::c_void as *mut Self;
(*this).count.add_ref()
}
}
unsafe extern "system" fn Release(this: *mut core::ffi::c_void) -> u32 {
unsafe {
let this = this as *mut *mut core::ffi::c_void as *mut Self;
let remaining = (*this).count.release();
if remaining == 0 {
let _ = windows_core::imp::Box::from_raw(this);
}
remaining
}
}
unsafe extern "system" fn Invoke(this: *mut core::ffi::c_void, sender: *mut core::ffi::c_void, args: *mut core::ffi::c_void) -> windows_core::HRESULT {
unsafe {
let this = &mut *(this as *mut *mut core::ffi::c_void as *mut Self);
(this.invoke)(core::mem::transmute_copy(&sender), core::mem::transmute_copy(&args)).into()
}
}
}
impl<F: Fn(windows_core::Ref<BackgroundTaskRegistration>, windows_core::Ref<BackgroundTaskProgressEventArgs>) -> windows_core::Result<()> + Send + 'static> From<windows_core::DelegateFn<F>> for BackgroundTaskProgressEventHandler {
fn from(value: windows_core::DelegateFn<F>) -> Self {
Self::new(value.0)
}
}
#[repr(transparent)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct BackgroundTaskRegistration(windows_core::IUnknown);
windows_core::imp::interface_hierarchy!(BackgroundTaskRegistration, windows_core::IUnknown, windows_core::IInspectable, IBackgroundTaskRegistration);
windows_core::imp::required_hierarchy!(BackgroundTaskRegistration, IBackgroundTaskRegistration2, IBackgroundTaskRegistration3);
impl BackgroundTaskRegistration {
pub fn TaskId(&self) -> windows_core::Result<windows_core::GUID> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).TaskId)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
}
}
pub fn Name(&self) -> windows_core::Result<windows_core::HSTRING> {
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).Name)(windows_core::Interface::as_raw(this), &mut result__).map(|| core::mem::transmute(result__))
}
}
pub fn Progress<P0>(&self, handler: P0) -> windows_core::Result<i64>
where
P0: windows_core::Param<BackgroundTaskProgressEventHandler>,
{
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).Progress)(windows_core::Interface::as_raw(this), handler.param().abi(), &mut result__).map(|| result__)
}
}
pub fn RemoveProgress(&self, cookie: i64) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).RemoveProgress)(windows_core::Interface::as_raw(this), cookie).ok() }
}
pub fn Completed<P0>(&self, handler: P0) -> windows_core::Result<i64>
where
P0: windows_core::Param<BackgroundTaskCompletedEventHandler>,
{
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).Completed)(windows_core::Interface::as_raw(this), handler.param().abi(), &mut result__).map(|| result__)
}
}
pub fn RemoveCompleted(&self, cookie: i64) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).RemoveCompleted)(windows_core::Interface::as_raw(this), cookie).ok() }
}
pub fn Unregister(&self, canceltask: bool) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).Unregister)(windows_core::Interface::as_raw(this), canceltask).ok() }
}
pub fn Trigger(&self) -> windows_core::Result<IBackgroundTrigger> {
let this = &windows_core::Interface::cast::<IBackgroundTaskRegistration2>(self)?;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).Trigger)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
}
}
pub fn TaskGroup(&self) -> windows_core::Result<BackgroundTaskRegistrationGroup> {
let this = &windows_core::Interface::cast::<IBackgroundTaskRegistration3>(self)?;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).TaskGroup)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
}
}
pub fn TaskLastThrottledInStandbyTimestamp(&self) -> windows_core::Result<super::super::Foundation::DateTime> {
let this = &windows_core::Interface::cast::<IBackgroundTaskRegistration4>(self)?;
unsafe {
let mut result__ = core::mem::zeroed();