-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.rs
767 lines (662 loc) · 20 KB
/
lib.rs
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
use proc_macro::TokenStream;
use proc_macro2::{Span, TokenStream as TokenStream2};
use quote::{quote, ToTokens};
use sha2::{Digest, Sha256};
use syn::{
parse, parse_macro_input, parse_quote, punctuated::Punctuated, token::Colon, token::Comma,
AttributeArgs, Expr, ExprPath, FnArg, GenericArgument, Ident, ItemFn, Pat, PatIdent, PatType,
Path, PathArguments, PathSegment, Type, TypePath,
};
/// For a message handler, generates:
/// - A rust binding for calling the method, and using it in a synchronous way
/// - Macros for including message handlers that pipeline messages back to the
/// client function
/// - A pipeline channel, which forwards results from the generated message
/// handlers back to the client function
/// - A wrapper implementing an actual message handler (doesn't return anything,
/// and accepts only simple copy types). This is achieved by serializing
/// non-copy parameters to memory cells (see allocator service)
#[proc_macro_attribute]
pub fn with_bindings(args: TokenStream, input: TokenStream) -> TokenStream {
let alloc_module: AttributeArgs = {
let args = args.clone();
parse_macro_input!(args as AttributeArgs)
};
let (alloc_module, extern_crate_pre): (Path, Path) = if alloc_module.len() > 0 {
(
parse_quote!(self),
Path {
leading_colon: None,
segments: Punctuated::new(),
},
)
} else {
(
parse_quote!(::vision_derive::beacon_dao_allocator),
parse_quote!(::vision_derive),
)
};
let mut input: ItemFn = parse(input).unwrap();
// The function must be a message handler: it must have a handle_ prefix
let msg_full_name = input.sig.ident.to_string();
let msg_name = msg_full_name.strip_prefix("handle_")
.expect("Must be a message handler starting with handle_, followed by the name of the message being handled.");
// Messages have ABI bindings generated that allow easy UX:
// - A pipeline mutex that allows bubbling results from handlers up to
// originating callers
// - Handler methods that
let msg_pipeline_name = Ident::new(
&format!("PIPELINE_{}", msg_name.to_ascii_uppercase()),
Span::call_site(),
);
// Uniquely identify this version of the handler from other handlers
let mut hasher = Sha256::new();
hasher.update(&input.to_token_stream().to_string()[..20]);
let handler_hash = hasher.finalize();
let msg_ret_handler_name = Ident::new(
&format!("handle_{}_{:x}_ret", msg_name, handler_hash),
Span::call_site(),
);
let ret_name = format!("{}_{:x}_ret", msg_name, handler_hash);
let msg_ident = input.sig.ident;
// Reattach #[] attrs to the newly generated wrapper function
let original_attrs = input.attrs.clone();
let extern_attrs = TokenStream2::from_iter(
input
.attrs
.drain(..input.attrs.len())
.map(|tok| tok.to_token_stream()),
);
let inner_ident = Ident::new(
&format!("inner_{}", msg_ident.to_string()),
Span::call_site(),
);
input.sig.ident = inner_ident.clone();
// Save argument names for proxying call to inner handlers
// Skip serializing the callback parametera
let mut arguments = {
let mut with_cb = input.sig.inputs.clone();
with_cb.pop();
// Ensure that previous arguments are not suffixed by a comma
if let Some(last_arg) = with_cb.pop() {
with_cb.push_value(last_arg.into_value());
}
with_cb
};
let args_iter = arguments.clone().into_iter().filter_map(|arg| match arg {
FnArg::Typed(arg) => Some(arg),
FnArg::Receiver(_) => panic!("Cannot use self in handler."),
});
let original_args: Punctuated<PatType, Comma> =
Punctuated::from_iter(args_iter.clone().skip(1));
let arg_names: Punctuated<Expr, Comma> = args_iter
.clone()
.map(|arg| arg.pat)
.filter_map(|pat| match *pat {
Pat::Ident(PatIdent { ident, .. }) => Some(Expr::Path(ExprPath {
attrs: Vec::new(),
qself: None,
path: Path {
leading_colon: None,
segments: {
let mut p = Punctuated::new();
p.push(PathSegment {
ident,
arguments: PathArguments::None,
});
p
},
},
})),
_ => panic!("Could not parse arguments."),
})
.collect();
fn gen_der(
args_iter: impl Iterator<Item = PatType>,
mut args: Option<&mut Punctuated<FnArg, Comma>>,
alloc_module: &Path,
extern_crate_pre: &Path,
mut callback: Option<TokenStream2>,
) -> TokenStream2 {
// Use #extern_crate_pre::serde_json to deserialize the parameters of the function
let mut der = TokenStream2::new();
let arg_types: Vec<(usize, (Ident, Ident))> = args_iter
.map(|arg| {
(
match *arg.pat {
Pat::Ident(pat) => Some(pat.ident),
_ => None,
}
.expect("Handlers may not have non-identifier arguments"),
arg.ty,
)
})
.map(|(ident, ty)| {
(
ident,
match *ty {
Type::Path(pat) => pat.path.segments.last().cloned(),
_ => None,
}
.expect("Handlers may not have non-identifier argument types")
.ident
.clone(),
)
})
.enumerate()
.collect();
let clone_items = arg_types
.iter()
.map(|(_i, (pat, _))| quote! {let #pat = #pat.clone();})
.collect::<Vec<TokenStream2>>();
let clone_all = clone_items
.clone()
.into_iter()
.enumerate()
.map(|(i, item_clone)| {
let also_clone = &clone_items[(i + 1)..];
let mut buf = quote! {
#item_clone
};
for to_clone in also_clone {
buf = quote! {
#buf
#to_clone
}
}
buf
})
.collect::<Vec<TokenStream2>>();
for (i, (pat, ty)) in arg_types.into_iter() {
let clone_all = &clone_all[i];
// Nest the callback after all arguments are deserialized
let callback = if i == 0 {
callback
.take()
.map(|cb| {
quote! {
let #pat = #pat.clone();
#clone_all
#cb
}
})
.unwrap_or(TokenStream2::new())
} else {
TokenStream2::new()
};
match ty.to_string().as_str() {
// No work needs to be done for copy types, since they are passed in as their values
"Address" | "i8" | "u8" | "i16" | "u16" | "i32" | "u32" | "i64" | "u64"
| "i128" | "u128" => {
der = quote! {
let #pat = #pat as #ty;
let #pat = std::sync::Arc::new(std::sync::Mutex::new(Some(#pat)));
{
#der
#callback
};
};
}
_ => {
der = quote! {
// Read until a } character is encoutnered (this should be JSON)
// or the results buffer isn't expanding
let cell = #pat;
#clone_all
#alloc_module::len(cell, Callback::new(move |len| {
let mut buf = std::sync::Arc::new(std::sync::Mutex::new(Vec::new()));
let n_done = std::sync::Arc::new(std::sync::atomic::AtomicU32::new(0));
for i in 0..len {
buf.lock().unwrap().push(0);
let buf = buf.clone();
let n_done = n_done.clone();
#clone_all
#alloc_module::read(cell, i, Callback::new(move |val| {
buf.lock().unwrap()[i as usize] = val;
if n_done.fetch_add(1, std::sync::atomic::Ordering::SeqCst) == len - 1 {
// This should not happen, since the wrapper method being used conforms to this practice
let #pat = std::sync::Arc::new(std::sync::Mutex::new(Some(#extern_crate_pre::serde_json::from_slice(&buf.lock().unwrap()).expect("Failed to deserialize input parameters."))));
#der
#callback
}
}));
}
}));
};
// Since a heap-allocated proxy was used to read the argument, accept it as an Address
if let Some(ref mut args) = args {
if let FnArg::Typed(ref mut typed_arg) = args[i] {
typed_arg.ty = parse_quote! {
#extern_crate_pre::vision_utils::types::Address
};
}
}
}
}
}
der
}
fn gen_ser(
args_iter: impl Iterator<Item = PatType> + Clone,
alloc_module: &Path,
extern_crate_pre: &Path,
mut callback: Option<TokenStream2>,
mut also_clone: Option<TokenStream2>,
) -> (TokenStream2, Vec<Option<TypePath>>) {
let mut type_buf: Vec<Option<TypePath>> = Vec::new();
let args_iter = args_iter
.filter_map(|arg| match *arg.pat {
Pat::Ident(id) => Some((id, arg.ty)),
_ => panic!("Arguments must be named"),
})
.filter_map(|(id, pat)| match *pat {
Type::Path(ty) => Some((id, ty)),
_ => panic!("Arguments must be typed"),
});
let total_bytes = args_iter.clone().fold(0, |acc, (_, ser_type)| {
acc + match ser_type
.path
.segments
.last()
.map(|p| p.ident.clone())
.expect("Invalid Type")
.to_string()
.as_str()
{
"u128" | "i128" => 16,
"i64" | "u64" => 8,
_ => 4, // Address (and anything serialied to an address), i32, u32
}
});
let mut gen_buf = TokenStream2::new();
let clone_items = args_iter
.clone()
.map(|(pat, _)| quote! {let #pat = #pat.clone();})
.collect::<Vec<TokenStream2>>();
let clone_all = clone_items
.clone()
.into_iter()
.enumerate()
.map(|(i, item_clone)| {
let prev_clone = &clone_items[(i + 1)..];
let mut buf = quote! {
let v_pos = v_pos.clone();
let v = v.clone();
let n_done = n_done.clone();
#item_clone
};
if let Some(also_clone) = also_clone.take() {
buf = quote! {
#also_clone
#buf
};
}
for to_clone in prev_clone {
buf = quote! {
#buf
#to_clone
}
}
buf
})
.collect::<Vec<TokenStream2>>();
for (i, (id, ser_type)) in args_iter.enumerate() {
let clone_all = &clone_all[i];
let ser_type_ident = ser_type
.path
.segments
.last()
.map(|p| p.ident.clone())
.expect("Invalid type");
// Callbacks may only be run if this is the last parameter being synchronously serialized
// or if the current item is being asynchronously serialized
let callback = if ![
"Address", "i8", "u8", "i16", "u16", "i32", "u32", "i64", "u64", "i128", "u128",
]
.contains(&ser_type_ident.to_string().as_str())
|| i == 0
{
callback.clone().map(|cb| {
quote! {
let #id = #id.clone();
#clone_all
#cb
}
})
} else {
None
};
gen_buf = {
// If the return value is a copy type, use its native representation
match ser_type_ident.to_string().as_str() {
"Address" | "i8" | "u8" | "i16" | "u16" | "i32" | "u32" | "i64" | "u64" | "i128" | "u128" => {
let min_equivalent = match ser_type_ident.to_string().as_str() {
"u8" | "Address" | "u16" | "u32" => quote!{u32},
"i8" | "i16" | "i32" => quote!{i32},
"i64" => quote!{i64},
"u64" => quote!{u64},
"i128" => quote!{i128},
"u128" => quote!{u128},
_ => quote!{u32},
};
type_buf.push(Some(ser_type));
Some(quote! {
let arg_bytes = (#id as #min_equivalent).to_le_bytes();
let #id = {
let lock = v.lock().unwrap();
lock.as_ptr() as i32
};
drop(&#id);
let v_start = (v_pos.fetch_sub(arg_bytes.len() as usize, std::sync::atomic::Ordering::SeqCst) - arg_bytes.len()) as usize;
let arg_bytes_iter = arg_bytes.into_iter();
{
let mut lock = v.lock().unwrap();
for (i, byte) in arg_bytes.into_iter().enumerate() {
lock[v_start + i] = byte;
}
}
if n_done.load(std::sync::atomic::Ordering::SeqCst) == 0 {
#callback
}
#gen_buf
})
}
_ => {
type_buf.push(Some(
parse_quote! {#extern_crate_pre::vision_utils::types::Address},
));
None
}
}
// Otherwise, use serde to pass in a memory cell address
.unwrap_or({
quote! {
let v_bytes = #extern_crate_pre::serde_json::to_vec(&#id).unwrap();
let #id = {
let lock = v.lock().unwrap();
lock.as_ptr() as i32
};
drop(&#id);
// Allocate a memory cell for the value
#clone_all
#alloc_module::allocate(#extern_crate_pre::vision_utils::types::ALLOCATOR_ADDR, #extern_crate_pre::vision_utils::types::Callback::new(move |res_buf: u32| {
#clone_all
#alloc_module::grow(res_buf, v_bytes.len() as u32, #extern_crate_pre::vision_utils::types::Callback::new(move |_| {
let arg_bytes = res_buf.to_le_bytes();
let v_start = (v_pos.fetch_sub(arg_bytes.len() as usize, std::sync::atomic::Ordering::SeqCst) - arg_bytes.len()) as usize;
let arg_bytes_iter = arg_bytes.into_iter();
{
let mut lock = v.lock().unwrap();
for (i, byte) in arg_bytes.into_iter().enumerate() {
lock[v_start + i] = byte;
}
}
for (i, b) in v_bytes.iter().enumerate() {
n_done.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
{
#clone_all
// Space for offset u32, and val u8
#alloc_module::write(res_buf, i as u32, *b, #extern_crate_pre::vision_utils::types::Callback::new(move |_| {
// The last byte was written
if n_done.fetch_sub(1, std::sync::atomic::Ordering::SeqCst) == 1 {
#callback
}
}));
}
}
#gen_buf
}));
}));
}
})
};
}
gen_buf = quote! {
use #extern_crate_pre::serde::Serialize;
let mut v: std::sync::Arc<std::sync::Mutex<Vec<u8>>> = std::sync::Arc::new(std::sync::Mutex::new(vec![0; #total_bytes as usize]));
let v_ptr = (*v.lock().unwrap()).as_ptr() as i32;
let n_done = std::sync::Arc::new(std::sync::atomic::AtomicUsize::new(0));
let v_pos = std::sync::Arc::new(std::sync::atomic::AtomicUsize::new(#total_bytes as usize));
drop(&v_ptr);
#gen_buf
};
(gen_buf, type_buf)
}
let ty = input
.sig
.inputs
.last()
.and_then(|cb| match cb {
FnArg::Typed(ty) => Some(ty),
_ => None,
})
.and_then(|cb_type| match &*cb_type.ty {
Type::Path(pat) => pat.path.segments.last(),
_ => None,
})
.and_then(|cb_ident| match cb_ident.ident.to_string().as_str() {
"Callback" => Some(cb_ident),
_ => panic!("callback must be a Callback<T>"),
})
.and_then(|cb_ident| match &cb_ident.arguments {
PathArguments::AngleBracketed(cb_type) => cb_type.args.last(),
_ => None,
})
.and_then(|cb_param_type| match cb_param_type {
GenericArgument::Type(ty) => Some(ty),
_ => None,
})
.expect("callback must be handled via a final `cb` argument");
let ser_type = Some(ty.clone());
let (ser, arg_type) = gen_ser(
vec![
PatType {
attrs: Vec::new(),
pat: parse_quote! {arg},
colon_token: Colon::default(),
ty: Box::new(ty.clone()),
},
// Identify returns as a response to a particular message call
PatType {
attrs: Vec::new(),
pat: parse_quote! {msg_id},
colon_token: Colon::default(),
ty: parse_quote! {u32},
},
]
.into_iter(),
&alloc_module,
&extern_crate_pre,
Some(quote! {
let handler_name = std::ffi::CString::new(#ret_name).expect("Invalid scheduler message kind encoding");
let lock = from.lock().unwrap();
send_message(lock.unwrap(), handler_name.as_ptr() as i32, arg);
}),
Some(parse_quote! {let from = from.clone();}),
);
let mut ret_handler_args: Punctuated<PatType, Comma> = Punctuated::new();
let mut ret_type: Option<TypePath> = None;
if let Some(arg_type) = arg_type.get(0).cloned().flatten() {
ret_type = Some(arg_type.clone());
ret_handler_args.push_value(PatType {
attrs: Vec::new(),
pat: parse_quote! {arg},
colon_token: Colon::default(),
ty: Box::new(Type::Path(arg_type.clone())),
});
ret_handler_args.push_punct(Comma::default());
ret_handler_args.push_value(PatType {
attrs: Vec::new(),
pat: parse_quote! {msg_id},
colon_token: Colon::default(),
ty: parse_quote! {u32},
});
}
let msg_name_vis = msg_name.to_string();
let client_return_deserialize_callback = quote! {
let mut lock = #msg_pipeline_name.write().unwrap();
let msg_id = msg_id.lock().unwrap().take().unwrap() as usize;
let maybe_cb = lock.get_mut(msg_id).unwrap().take();
if let Some(callback) = maybe_cb {
let arg = arg.lock().unwrap().take().unwrap();
callback.call(arg);
}
};
let ret_der = gen_der(
{
let mut safe_args = ret_handler_args.clone();
if let Some(mut arg) = safe_args.first_mut() {
arg.ty = Box::new(ser_type.clone().unwrap());
}
safe_args.into_iter()
},
None,
&alloc_module,
&extern_crate_pre,
Some(client_return_deserialize_callback),
);
let args_ptr: Expr = parse_quote! {v_ptr};
let (client_arg_ser, _) = gen_ser(
{
// Only generate msg_id if a response is expected
let mut client_original_args = original_args.clone();
client_original_args.push(PatType {
attrs: Vec::new(),
pat: parse_quote! {msg_id},
colon_token: Colon::default(),
ty: parse_quote! {u32},
});
client_original_args
}
.into_iter(),
&alloc_module,
&extern_crate_pre,
Some(quote! {
let msg_kind = std::ffi::CString::new(#msg_name_vis)
.expect("Invalid scheduler message kind encoding");
send_message(to,
msg_kind.as_ptr() as i32,
#args_ptr);
}),
None,
);
let further_processing = match arg_type.get(0).cloned().flatten() {
Some(_) => quote! {
let cb = {
let from = from.clone();
move |arg: #ser_type| {
#ser
}
};
},
None => quote! {},
};
// Use the serializer to return a WASM-compatible response to consumers
// and generate bindings that streamline sending the message, and getting a
// response
let mut consumed_arg_names: Punctuated<Expr, Comma> = Punctuated::new();
consumed_arg_names.push(parse_quote! {from});
arg_names
.clone()
.into_iter()
.skip(1)
.map(|arg: Expr| -> Expr {
parse_quote! {#arg.lock().unwrap().take().unwrap()}
})
.for_each(|val| consumed_arg_names.push(val));
let deserialize_server_args_callback = quote! {
#further_processing
let from = {
from.lock().unwrap().clone().unwrap()
};
#inner_ident(#consumed_arg_names, #extern_crate_pre::vision_utils::types::Callback::new(cb));
};
// TODO: Ensure that this generates deserializers for arg when it is not a
// copy type in client-side code
let der = gen_der(
args_iter,
Some(&mut arguments),
&alloc_module,
&extern_crate_pre,
Some(deserialize_server_args_callback),
);
let mut gen = quote! {
#[cfg(feature = "module")]
#extern_attrs
pub extern "C" fn #msg_ident(#arguments, msg_id: u32) {
use #extern_crate_pre::vision_utils::actor::send_message;
#der
}
#[cfg(feature = "module")]
#input
};
let msg_name_ident = Ident::new(msg_name, Span::call_site());
// User arguments are prefixed by a to: Address arg
let proper_args = {
let mut buff = original_args.clone();
buff.insert(
0,
PatType {
attrs: Vec::new(),
pat: parse_quote! {to},
colon_token: Colon::default(),
ty: parse_quote! {#extern_crate_pre::vision_utils::types::Address},
},
);
buff
};
// We have already generated the private-usage client copy
let private_bindings: TokenStream2 = if msg_name.ends_with("_priv") {
TokenStream::new().into()
} else {
let mut new_input = input.clone();
let old_ident = new_input.sig.ident.to_string();
new_input.sig.ident = Ident::new(
&format!("{}_priv", old_ident.strip_prefix("inner_").unwrap()),
Span::call_site(),
);
new_input.attrs = original_attrs;
with_bindings(args, new_input.to_token_stream().into()).into()
};
// Super scuffed
let pub_binding_ret_vis = if msg_name.ends_with("_priv") {
quote! {
#[cfg(feature = "module")]
}
} else {
quote! {#[cfg(not(feature = "module"))]}
};
// Include handlers for the response value if there is one
if let Some(ret_type) = ret_type {
gen = quote! {
#gen
pub static #msg_pipeline_name: std::sync::RwLock<Vec<Option<Callback<#ser_type>>>> = std::sync::RwLock::new(Vec::new());
#pub_binding_ret_vis
#[no_mangle]
pub extern "C" fn #msg_ret_handler_name(from: #extern_crate_pre::vision_utils::types::Address, arg: #ret_type, msg_id: u32) {
#ret_der
}
pub fn #msg_name_ident(#proper_args, callback: Callback<#ser_type>) {
use #extern_crate_pre::vision_utils::actor::send_message;
let msg_id: u32 = {
let mut lock = #msg_pipeline_name.write().unwrap();
lock.push(Some(callback));
let id = lock.len() as u32 - 1;
id
};
#client_arg_ser
}
#private_bindings
}
} else {
gen = quote! {
#gen
pub fn #msg_name_ident(#proper_args) {
use #extern_crate_pre::vision_utils::actor::send_message;
let msg_id: u32 = 0;
#client_arg_ser
}
}
}
TokenStream::from(gen)
}