@@ -437,6 +437,128 @@ impl wkt::message::Message for MessageWithI64 {
437
437
}
438
438
}
439
439
440
+ /// A test message for u64.
441
+ #[ serde_with:: serde_as]
442
+ #[ derive( Clone , Debug , Default , PartialEq , serde:: Deserialize , serde:: Serialize ) ]
443
+ #[ serde( default , rename_all = "camelCase" ) ]
444
+ #[ non_exhaustive]
445
+ pub struct MessageWithU64 {
446
+
447
+ /// A singular field.
448
+ #[ serde( skip_serializing_if = "wkt::internal::is_default" ) ]
449
+ #[ serde_as( as = "wkt::internal::U64" ) ]
450
+ pub singular : u64 ,
451
+
452
+ /// An optional field.
453
+ #[ serde( skip_serializing_if = "std::option::Option::is_none" ) ]
454
+ #[ serde_as( as = "std::option::Option<wkt::internal::U64>" ) ]
455
+ pub optional : std:: option:: Option < u64 > ,
456
+
457
+ /// A repeated field.
458
+ #[ serde( skip_serializing_if = "std::vec::Vec::is_empty" ) ]
459
+ #[ serde_as( as = "std::vec::Vec<wkt::internal::U64>" ) ]
460
+ pub repeated : std:: vec:: Vec < u64 > ,
461
+
462
+ /// Test u64 as values.
463
+ #[ serde( skip_serializing_if = "std::collections::HashMap::is_empty" ) ]
464
+ #[ serde_as( as = "std::collections::HashMap<_, wkt::internal::U64>" ) ]
465
+ pub map_value : std:: collections:: HashMap < std:: string:: String , u64 > ,
466
+
467
+ /// Test u64 as keys.
468
+ #[ serde( skip_serializing_if = "std::collections::HashMap::is_empty" ) ]
469
+ #[ serde_as( as = "std::collections::HashMap<wkt::internal::U64, _>" ) ]
470
+ pub map_key : std:: collections:: HashMap < u64 , std:: string:: String > ,
471
+
472
+ /// Test u64 as both keys and values.
473
+ #[ serde( skip_serializing_if = "std::collections::HashMap::is_empty" ) ]
474
+ #[ serde_as( as = "std::collections::HashMap<wkt::internal::U64, wkt::internal::U64>" ) ]
475
+ pub map_key_value : std:: collections:: HashMap < u64 , u64 > ,
476
+
477
+ #[ serde( flatten, skip_serializing_if = "serde_json::Map::is_empty" ) ]
478
+ _unknown_fields : serde_json:: Map < std:: string:: String , serde_json:: Value > ,
479
+ }
480
+
481
+ impl MessageWithU64 {
482
+ pub fn new ( ) -> Self {
483
+ std:: default:: Default :: default ( )
484
+ }
485
+
486
+ /// Sets the value of [singular][crate::protos::MessageWithU64::singular].
487
+ pub fn set_singular < T : std:: convert:: Into < u64 > > ( mut self , v : T ) -> Self {
488
+ self . singular = v. into ( ) ;
489
+ self
490
+ }
491
+
492
+ /// Sets the value of [optional][crate::protos::MessageWithU64::optional].
493
+ pub fn set_optional < T > ( mut self , v : T ) -> Self
494
+ where T : std:: convert:: Into < u64 >
495
+ {
496
+ self . optional = std:: option:: Option :: Some ( v. into ( ) ) ;
497
+ self
498
+ }
499
+
500
+ /// Sets or clears the value of [optional][crate::protos::MessageWithU64::optional].
501
+ pub fn set_or_clear_optional < T > ( mut self , v : std:: option:: Option < T > ) -> Self
502
+ where T : std:: convert:: Into < u64 >
503
+ {
504
+ self . optional = v. map ( |x| x. into ( ) ) ;
505
+ self
506
+ }
507
+
508
+ /// Sets the value of [repeated][crate::protos::MessageWithU64::repeated].
509
+ pub fn set_repeated < T , V > ( mut self , v : T ) -> Self
510
+ where
511
+ T : std:: iter:: IntoIterator < Item = V > ,
512
+ V : std:: convert:: Into < u64 >
513
+ {
514
+ use std:: iter:: Iterator ;
515
+ self . repeated = v. into_iter ( ) . map ( |i| i. into ( ) ) . collect ( ) ;
516
+ self
517
+ }
518
+
519
+ /// Sets the value of [map_value][crate::protos::MessageWithU64::map_value].
520
+ pub fn set_map_value < T , K , V > ( mut self , v : T ) -> Self
521
+ where
522
+ T : std:: iter:: IntoIterator < Item = ( K , V ) > ,
523
+ K : std:: convert:: Into < std:: string:: String > ,
524
+ V : std:: convert:: Into < u64 > ,
525
+ {
526
+ use std:: iter:: Iterator ;
527
+ self . map_value = v. into_iter ( ) . map ( |( k, v) | ( k. into ( ) , v. into ( ) ) ) . collect ( ) ;
528
+ self
529
+ }
530
+
531
+ /// Sets the value of [map_key][crate::protos::MessageWithU64::map_key].
532
+ pub fn set_map_key < T , K , V > ( mut self , v : T ) -> Self
533
+ where
534
+ T : std:: iter:: IntoIterator < Item = ( K , V ) > ,
535
+ K : std:: convert:: Into < u64 > ,
536
+ V : std:: convert:: Into < std:: string:: String > ,
537
+ {
538
+ use std:: iter:: Iterator ;
539
+ self . map_key = v. into_iter ( ) . map ( |( k, v) | ( k. into ( ) , v. into ( ) ) ) . collect ( ) ;
540
+ self
541
+ }
542
+
543
+ /// Sets the value of [map_key_value][crate::protos::MessageWithU64::map_key_value].
544
+ pub fn set_map_key_value < T , K , V > ( mut self , v : T ) -> Self
545
+ where
546
+ T : std:: iter:: IntoIterator < Item = ( K , V ) > ,
547
+ K : std:: convert:: Into < u64 > ,
548
+ V : std:: convert:: Into < u64 > ,
549
+ {
550
+ use std:: iter:: Iterator ;
551
+ self . map_key_value = v. into_iter ( ) . map ( |( k, v) | ( k. into ( ) , v. into ( ) ) ) . collect ( ) ;
552
+ self
553
+ }
554
+ }
555
+
556
+ impl wkt:: message:: Message for MessageWithU64 {
557
+ fn typename ( ) -> & ' static str {
558
+ "type.googleapis.com/google.rust.sdk.test.MessageWithU64"
559
+ }
560
+ }
561
+
440
562
/// A test message for bytes.
441
563
#[ serde_with:: serde_as]
442
564
#[ derive( Clone , Debug , Default , PartialEq , serde:: Deserialize , serde:: Serialize ) ]
0 commit comments