-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathcodegen__codegen_rust.snap
More file actions
4037 lines (3386 loc) · 126 KB
/
codegen__codegen_rust.snap
File metadata and controls
4037 lines (3386 loc) · 126 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
---
source: crates/codegen/tests/codegen.rs
expression: outfiles
---
"add_player_reducer.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub(super) struct AddPlayerArgs {
pub name: String,
}
impl From<AddPlayerArgs> for super::Reducer {
fn from(args: AddPlayerArgs) -> Self {
Self::AddPlayer {
name: args.name,
}
}
}
impl __sdk::InModule for AddPlayerArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the reducer `add_player`.
///
/// Implemented for [`super::RemoteReducers`].
pub trait add_player {
/// Request that the remote module invoke the reducer `add_player` to run as soon as possible.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`add_player:add_player_then`] to run a callback after the reducer completes.
fn add_player(&self, name: String,
) -> __sdk::Result<()> {
self.add_player_then(name, |_, _| {})
}
/// Request that the remote module invoke the reducer `add_player` to run as soon as possible,
/// registering `callback` to run when we are notified that the reducer completed.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and its status can be observed with the `callback`.
fn add_player_then(
&self,
name: String,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()>;
}
impl add_player for super::RemoteReducers {
fn add_player_then(
&self,
name: String,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp.invoke_reducer_with_callback(AddPlayerArgs { name, }, callback)
}
}
'''
"add_private_reducer.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub(super) struct AddPrivateArgs {
pub name: String,
}
impl From<AddPrivateArgs> for super::Reducer {
fn from(args: AddPrivateArgs) -> Self {
Self::AddPrivate {
name: args.name,
}
}
}
impl __sdk::InModule for AddPrivateArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the reducer `add_private`.
///
/// Implemented for [`super::RemoteReducers`].
pub trait add_private {
/// Request that the remote module invoke the reducer `add_private` to run as soon as possible.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`add_private:add_private_then`] to run a callback after the reducer completes.
fn add_private(&self, name: String,
) -> __sdk::Result<()> {
self.add_private_then(name, |_, _| {})
}
/// Request that the remote module invoke the reducer `add_private` to run as soon as possible,
/// registering `callback` to run when we are notified that the reducer completed.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and its status can be observed with the `callback`.
fn add_private_then(
&self,
name: String,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()>;
}
impl add_private for super::RemoteReducers {
fn add_private_then(
&self,
name: String,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp.invoke_reducer_with_callback(AddPrivateArgs { name, }, callback)
}
}
'''
"add_reducer.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub(super) struct AddArgs {
pub name: String,
pub age: u8,
}
impl From<AddArgs> for super::Reducer {
fn from(args: AddArgs) -> Self {
Self::Add {
name: args.name,
age: args.age,
}
}
}
impl __sdk::InModule for AddArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the reducer `add`.
///
/// Implemented for [`super::RemoteReducers`].
pub trait add {
/// Request that the remote module invoke the reducer `add` to run as soon as possible.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`add:add_then`] to run a callback after the reducer completes.
fn add(&self, name: String,
age: u8,
) -> __sdk::Result<()> {
self.add_then(name, age, |_, _| {})
}
/// Request that the remote module invoke the reducer `add` to run as soon as possible,
/// registering `callback` to run when we are notified that the reducer completed.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and its status can be observed with the `callback`.
fn add_then(
&self,
name: String,
age: u8,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()>;
}
impl add for super::RemoteReducers {
fn add_then(
&self,
name: String,
age: u8,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp.invoke_reducer_with_callback(AddArgs { name, age, }, callback)
}
}
'''
"assert_caller_identity_is_module_identity_reducer.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub(super) struct AssertCallerIdentityIsModuleIdentityArgs {
}
impl From<AssertCallerIdentityIsModuleIdentityArgs> for super::Reducer {
fn from(args: AssertCallerIdentityIsModuleIdentityArgs) -> Self {
Self::AssertCallerIdentityIsModuleIdentity
}
}
impl __sdk::InModule for AssertCallerIdentityIsModuleIdentityArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the reducer `assert_caller_identity_is_module_identity`.
///
/// Implemented for [`super::RemoteReducers`].
pub trait assert_caller_identity_is_module_identity {
/// Request that the remote module invoke the reducer `assert_caller_identity_is_module_identity` to run as soon as possible.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`assert_caller_identity_is_module_identity:assert_caller_identity_is_module_identity_then`] to run a callback after the reducer completes.
fn assert_caller_identity_is_module_identity(&self, ) -> __sdk::Result<()> {
self.assert_caller_identity_is_module_identity_then( |_, _| {})
}
/// Request that the remote module invoke the reducer `assert_caller_identity_is_module_identity` to run as soon as possible,
/// registering `callback` to run when we are notified that the reducer completed.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and its status can be observed with the `callback`.
fn assert_caller_identity_is_module_identity_then(
&self,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()>;
}
impl assert_caller_identity_is_module_identity for super::RemoteReducers {
fn assert_caller_identity_is_module_identity_then(
&self,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp.invoke_reducer_with_callback(AssertCallerIdentityIsModuleIdentityArgs { }, callback)
}
}
'''
"baz_type.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct Baz {
pub field: String,
}
impl __sdk::InModule for Baz {
type Module = super::RemoteModule;
}
'''
"delete_player_reducer.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub(super) struct DeletePlayerArgs {
pub id: u64,
}
impl From<DeletePlayerArgs> for super::Reducer {
fn from(args: DeletePlayerArgs) -> Self {
Self::DeletePlayer {
id: args.id,
}
}
}
impl __sdk::InModule for DeletePlayerArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the reducer `delete_player`.
///
/// Implemented for [`super::RemoteReducers`].
pub trait delete_player {
/// Request that the remote module invoke the reducer `delete_player` to run as soon as possible.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`delete_player:delete_player_then`] to run a callback after the reducer completes.
fn delete_player(&self, id: u64,
) -> __sdk::Result<()> {
self.delete_player_then(id, |_, _| {})
}
/// Request that the remote module invoke the reducer `delete_player` to run as soon as possible,
/// registering `callback` to run when we are notified that the reducer completed.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and its status can be observed with the `callback`.
fn delete_player_then(
&self,
id: u64,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()>;
}
impl delete_player for super::RemoteReducers {
fn delete_player_then(
&self,
id: u64,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp.invoke_reducer_with_callback(DeletePlayerArgs { id, }, callback)
}
}
'''
"delete_players_by_name_reducer.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub(super) struct DeletePlayersByNameArgs {
pub name: String,
}
impl From<DeletePlayersByNameArgs> for super::Reducer {
fn from(args: DeletePlayersByNameArgs) -> Self {
Self::DeletePlayersByName {
name: args.name,
}
}
}
impl __sdk::InModule for DeletePlayersByNameArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the reducer `delete_players_by_name`.
///
/// Implemented for [`super::RemoteReducers`].
pub trait delete_players_by_name {
/// Request that the remote module invoke the reducer `delete_players_by_name` to run as soon as possible.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`delete_players_by_name:delete_players_by_name_then`] to run a callback after the reducer completes.
fn delete_players_by_name(&self, name: String,
) -> __sdk::Result<()> {
self.delete_players_by_name_then(name, |_, _| {})
}
/// Request that the remote module invoke the reducer `delete_players_by_name` to run as soon as possible,
/// registering `callback` to run when we are notified that the reducer completed.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and its status can be observed with the `callback`.
fn delete_players_by_name_then(
&self,
name: String,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()>;
}
impl delete_players_by_name for super::RemoteReducers {
fn delete_players_by_name_then(
&self,
name: String,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp.invoke_reducer_with_callback(DeletePlayersByNameArgs { name, }, callback)
}
}
'''
"foobar_type.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::baz_type::Baz;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub enum Foobar {
Baz(Baz),
Bar,
Har(u32),
}
impl __sdk::InModule for Foobar {
type Module = super::RemoteModule;
}
'''
"get_my_schema_via_http_procedure.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct GetMySchemaViaHttpArgs {
}
impl __sdk::InModule for GetMySchemaViaHttpArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `get_my_schema_via_http`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait get_my_schema_via_http {
fn get_my_schema_via_http(&self, ) {
self.get_my_schema_via_http_then( |_, _| {});
}
fn get_my_schema_via_http_then(
&self,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<String, __sdk::InternalError>) + Send + 'static,
);
}
impl get_my_schema_via_http for super::RemoteProcedures {
fn get_my_schema_via_http_then(
&self,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<String, __sdk::InternalError>) + Send + 'static,
) {
self.imp.invoke_procedure_with_callback::<_, String>(
"get_my_schema_via_http",
GetMySchemaViaHttpArgs { },
__callback,
);
}
}
'''
"has_special_stuff_type.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct HasSpecialStuff {
pub identity: __sdk::Identity,
pub connection_id: __sdk::ConnectionId,
}
impl __sdk::InModule for HasSpecialStuff {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `HasSpecialStuff`.
///
/// Provides typed access to columns for query building.
pub struct HasSpecialStuffCols {
pub identity: __sdk::__query_builder::Col<HasSpecialStuff, __sdk::Identity>,
pub connection_id: __sdk::__query_builder::Col<HasSpecialStuff, __sdk::ConnectionId>,
}
impl __sdk::__query_builder::HasCols for HasSpecialStuff {
type Cols = HasSpecialStuffCols;
fn cols(table_name: &'static str) -> Self::Cols {
HasSpecialStuffCols {
identity: __sdk::__query_builder::Col::new(table_name, "identity"),
connection_id: __sdk::__query_builder::Col::new(table_name, "connection_id"),
}
}
}
/// Indexed column accessor struct for the table `HasSpecialStuff`.
///
/// Provides typed access to indexed columns for query building.
pub struct HasSpecialStuffIxCols {
}
impl __sdk::__query_builder::HasIxCols for HasSpecialStuff {
type IxCols = HasSpecialStuffIxCols;
fn ix_cols(table_name: &'static str) -> Self::IxCols {
HasSpecialStuffIxCols {
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for HasSpecialStuff {}
'''
"list_over_age_reducer.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub(super) struct ListOverAgeArgs {
pub age: u8,
}
impl From<ListOverAgeArgs> for super::Reducer {
fn from(args: ListOverAgeArgs) -> Self {
Self::ListOverAge {
age: args.age,
}
}
}
impl __sdk::InModule for ListOverAgeArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the reducer `list_over_age`.
///
/// Implemented for [`super::RemoteReducers`].
pub trait list_over_age {
/// Request that the remote module invoke the reducer `list_over_age` to run as soon as possible.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`list_over_age:list_over_age_then`] to run a callback after the reducer completes.
fn list_over_age(&self, age: u8,
) -> __sdk::Result<()> {
self.list_over_age_then(age, |_, _| {})
}
/// Request that the remote module invoke the reducer `list_over_age` to run as soon as possible,
/// registering `callback` to run when we are notified that the reducer completed.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and its status can be observed with the `callback`.
fn list_over_age_then(
&self,
age: u8,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()>;
}
impl list_over_age for super::RemoteReducers {
fn list_over_age_then(
&self,
age: u8,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp.invoke_reducer_with_callback(ListOverAgeArgs { age, }, callback)
}
}
'''
"log_module_identity_reducer.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub(super) struct LogModuleIdentityArgs {
}
impl From<LogModuleIdentityArgs> for super::Reducer {
fn from(args: LogModuleIdentityArgs) -> Self {
Self::LogModuleIdentity
}
}
impl __sdk::InModule for LogModuleIdentityArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the reducer `log_module_identity`.
///
/// Implemented for [`super::RemoteReducers`].
pub trait log_module_identity {
/// Request that the remote module invoke the reducer `log_module_identity` to run as soon as possible.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`log_module_identity:log_module_identity_then`] to run a callback after the reducer completes.
fn log_module_identity(&self, ) -> __sdk::Result<()> {
self.log_module_identity_then( |_, _| {})
}
/// Request that the remote module invoke the reducer `log_module_identity` to run as soon as possible,
/// registering `callback` to run when we are notified that the reducer completed.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and its status can be observed with the `callback`.
fn log_module_identity_then(
&self,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()>;
}
impl log_module_identity for super::RemoteReducers {
fn log_module_identity_then(
&self,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp.invoke_reducer_with_callback(LogModuleIdentityArgs { }, callback)
}
}
'''
"logged_out_player_table.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::player_type::Player;
/// Table handle for the table `logged_out_player`.
///
/// Obtain a handle from the [`LoggedOutPlayerTableAccess::logged_out_player`] method on [`super::RemoteTables`],
/// like `ctx.db.logged_out_player()`.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.logged_out_player().on_insert(...)`.
pub struct LoggedOutPlayerTableHandle<'ctx> {
imp: __sdk::TableHandle<Player>,
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the table `logged_out_player`.
///
/// Implemented for [`super::RemoteTables`].
pub trait LoggedOutPlayerTableAccess {
#[allow(non_snake_case)]
/// Obtain a [`LoggedOutPlayerTableHandle`], which mediates access to the table `logged_out_player`.
fn logged_out_player(&self) -> LoggedOutPlayerTableHandle<'_>;
}
impl LoggedOutPlayerTableAccess for super::RemoteTables {
fn logged_out_player(&self) -> LoggedOutPlayerTableHandle<'_> {
LoggedOutPlayerTableHandle {
imp: self.imp.get_table::<Player>("logged_out_player"),
ctx: std::marker::PhantomData,
}
}
}
pub struct LoggedOutPlayerInsertCallbackId(__sdk::CallbackId);
pub struct LoggedOutPlayerDeleteCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::Table for LoggedOutPlayerTableHandle<'ctx> {
type Row = Player;
type EventContext = super::EventContext;
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = Player> + '_ { self.imp.iter() }
type InsertCallbackId = LoggedOutPlayerInsertCallbackId;
fn on_insert(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> LoggedOutPlayerInsertCallbackId {
LoggedOutPlayerInsertCallbackId(self.imp.on_insert(Box::new(callback)))
}
fn remove_on_insert(&self, callback: LoggedOutPlayerInsertCallbackId) {
self.imp.remove_on_insert(callback.0)
}
type DeleteCallbackId = LoggedOutPlayerDeleteCallbackId;
fn on_delete(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> LoggedOutPlayerDeleteCallbackId {
LoggedOutPlayerDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
}
fn remove_on_delete(&self, callback: LoggedOutPlayerDeleteCallbackId) {
self.imp.remove_on_delete(callback.0)
}
}
pub struct LoggedOutPlayerUpdateCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::TableWithPrimaryKey for LoggedOutPlayerTableHandle<'ctx> {
type UpdateCallbackId = LoggedOutPlayerUpdateCallbackId;
fn on_update(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
) -> LoggedOutPlayerUpdateCallbackId {
LoggedOutPlayerUpdateCallbackId(self.imp.on_update(Box::new(callback)))
}
fn remove_on_update(&self, callback: LoggedOutPlayerUpdateCallbackId) {
self.imp.remove_on_update(callback.0)
}
}
/// Access to the `identity` unique index on the table `logged_out_player`,
/// which allows point queries on the field of the same name
/// via the [`LoggedOutPlayerIdentityUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.logged_out_player().identity().find(...)`.
pub struct LoggedOutPlayerIdentityUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<Player, __sdk::Identity>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> LoggedOutPlayerTableHandle<'ctx> {
/// Get a handle on the `identity` unique index on the table `logged_out_player`.
pub fn identity(&self) -> LoggedOutPlayerIdentityUnique<'ctx> {
LoggedOutPlayerIdentityUnique {
imp: self.imp.get_unique_constraint::<__sdk::Identity>("identity"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> LoggedOutPlayerIdentityUnique<'ctx> {
/// Find the subscribed row whose `identity` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &__sdk::Identity) -> Option<Player> {
self.imp.find(col_val)
}
}
/// Access to the `player_id` unique index on the table `logged_out_player`,
/// which allows point queries on the field of the same name
/// via the [`LoggedOutPlayerPlayerIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.logged_out_player().player_id().find(...)`.
pub struct LoggedOutPlayerPlayerIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<Player, u64>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> LoggedOutPlayerTableHandle<'ctx> {
/// Get a handle on the `player_id` unique index on the table `logged_out_player`.
pub fn player_id(&self) -> LoggedOutPlayerPlayerIdUnique<'ctx> {
LoggedOutPlayerPlayerIdUnique {
imp: self.imp.get_unique_constraint::<u64>("player_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> LoggedOutPlayerPlayerIdUnique<'ctx> {
/// Find the subscribed row whose `player_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &u64) -> Option<Player> {
self.imp.find(col_val)
}
}
/// Access to the `name` unique index on the table `logged_out_player`,
/// which allows point queries on the field of the same name
/// via the [`LoggedOutPlayerNameUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.logged_out_player().name().find(...)`.
pub struct LoggedOutPlayerNameUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<Player, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> LoggedOutPlayerTableHandle<'ctx> {
/// Get a handle on the `name` unique index on the table `logged_out_player`.
pub fn name(&self) -> LoggedOutPlayerNameUnique<'ctx> {
LoggedOutPlayerNameUnique {
imp: self.imp.get_unique_constraint::<String>("name"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> LoggedOutPlayerNameUnique<'ctx> {
/// Find the subscribed row whose `name` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<Player> {
self.imp.find(col_val)
}
}
#[doc(hidden)]
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
let _table = client_cache.get_or_make_table::<Player>("logged_out_player");
_table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity);
_table.add_unique_constraint::<u64>("player_id", |row| &row.player_id);
_table.add_unique_constraint::<String>("name", |row| &row.name);
}
#[doc(hidden)]
pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<Player>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse(
"TableUpdate<Player>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `Player`.
///