@@ -28,18 +28,19 @@ pub mod host_response {
2828 since = "2.0.0" ,
2929 note = "Use associated constants instead. This will no longer be generated in 2021."
3030 ) ]
31- pub const ENUM_MAX_CONTRACT_RESPONSE_TYPE : u8 = 4 ;
31+ pub const ENUM_MAX_CONTRACT_RESPONSE_TYPE : u8 = 5 ;
3232 #[ deprecated(
3333 since = "2.0.0" ,
3434 note = "Use associated constants instead. This will no longer be generated in 2021."
3535 ) ]
3636 #[ allow( non_camel_case_types) ]
37- pub const ENUM_VALUES_CONTRACT_RESPONSE_TYPE : [ ContractResponseType ; 5 ] = [
37+ pub const ENUM_VALUES_CONTRACT_RESPONSE_TYPE : [ ContractResponseType ; 6 ] = [
3838 ContractResponseType :: NONE ,
3939 ContractResponseType :: GetResponse ,
4040 ContractResponseType :: PutResponse ,
4141 ContractResponseType :: UpdateNotification ,
4242 ContractResponseType :: UpdateResponse ,
43+ ContractResponseType :: NotFound ,
4344 ] ;
4445
4546 #[ derive( Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash , Default ) ]
@@ -52,15 +53,17 @@ pub mod host_response {
5253 pub const PutResponse : Self = Self ( 2 ) ;
5354 pub const UpdateNotification : Self = Self ( 3 ) ;
5455 pub const UpdateResponse : Self = Self ( 4 ) ;
56+ pub const NotFound : Self = Self ( 5 ) ;
5557
5658 pub const ENUM_MIN : u8 = 0 ;
57- pub const ENUM_MAX : u8 = 4 ;
59+ pub const ENUM_MAX : u8 = 5 ;
5860 pub const ENUM_VALUES : & ' static [ Self ] = & [
5961 Self :: NONE ,
6062 Self :: GetResponse ,
6163 Self :: PutResponse ,
6264 Self :: UpdateNotification ,
6365 Self :: UpdateResponse ,
66+ Self :: NotFound ,
6467 ] ;
6568 /// Returns the variant's name or "" if unknown.
6669 pub fn variant_name ( self ) -> Option < & ' static str > {
@@ -70,6 +73,7 @@ pub mod host_response {
7073 Self :: PutResponse => Some ( "PutResponse" ) ,
7174 Self :: UpdateNotification => Some ( "UpdateNotification" ) ,
7275 Self :: UpdateResponse => Some ( "UpdateResponse" ) ,
76+ Self :: NotFound => Some ( "NotFound" ) ,
7377 _ => None ,
7478 }
7579 }
@@ -996,6 +1000,134 @@ pub mod host_response {
9961000 ds. finish ( )
9971001 }
9981002 }
1003+ pub enum NotFoundOffset { }
1004+ #[ derive( Copy , Clone , PartialEq ) ]
1005+
1006+ pub struct NotFound < ' a > {
1007+ pub _tab : flatbuffers:: Table < ' a > ,
1008+ }
1009+
1010+ impl < ' a > flatbuffers:: Follow < ' a > for NotFound < ' a > {
1011+ type Inner = NotFound < ' a > ;
1012+ #[ inline]
1013+ unsafe fn follow ( buf : & ' a [ u8 ] , loc : usize ) -> Self :: Inner {
1014+ Self {
1015+ _tab : flatbuffers:: Table :: new ( buf, loc) ,
1016+ }
1017+ }
1018+ }
1019+
1020+ impl < ' a > NotFound < ' a > {
1021+ pub const VT_INSTANCE_ID : flatbuffers:: VOffsetT = 4 ;
1022+
1023+ #[ inline]
1024+ pub unsafe fn init_from_table ( table : flatbuffers:: Table < ' a > ) -> Self {
1025+ NotFound { _tab : table }
1026+ }
1027+ #[ allow( unused_mut) ]
1028+ pub fn create <
1029+ ' bldr : ' args ,
1030+ ' args : ' mut_bldr ,
1031+ ' mut_bldr ,
1032+ A : flatbuffers:: Allocator + ' bldr ,
1033+ > (
1034+ _fbb : & ' mut_bldr mut flatbuffers:: FlatBufferBuilder < ' bldr , A > ,
1035+ args : & ' args NotFoundArgs < ' args > ,
1036+ ) -> flatbuffers:: WIPOffset < NotFound < ' bldr > > {
1037+ let mut builder = NotFoundBuilder :: new ( _fbb) ;
1038+ if let Some ( x) = args. instance_id {
1039+ builder. add_instance_id ( x) ;
1040+ }
1041+ builder. finish ( )
1042+ }
1043+
1044+ #[ inline]
1045+ pub fn instance_id ( & self ) -> super :: common:: ContractInstanceId < ' a > {
1046+ // Safety:
1047+ // Created from valid Table for this object
1048+ // which contains a valid value in this slot
1049+ unsafe {
1050+ self . _tab
1051+ . get :: < flatbuffers:: ForwardsUOffset < super :: common:: ContractInstanceId > > (
1052+ NotFound :: VT_INSTANCE_ID ,
1053+ None ,
1054+ )
1055+ . unwrap ( )
1056+ }
1057+ }
1058+ }
1059+
1060+ impl flatbuffers:: Verifiable for NotFound < ' _ > {
1061+ #[ inline]
1062+ fn run_verifier (
1063+ v : & mut flatbuffers:: Verifier ,
1064+ pos : usize ,
1065+ ) -> Result < ( ) , flatbuffers:: InvalidFlatbuffer > {
1066+ use self :: flatbuffers:: Verifiable ;
1067+ v. visit_table ( pos) ?
1068+ . visit_field :: < flatbuffers:: ForwardsUOffset < super :: common:: ContractInstanceId > > (
1069+ "instance_id" ,
1070+ Self :: VT_INSTANCE_ID ,
1071+ true ,
1072+ ) ?
1073+ . finish ( ) ;
1074+ Ok ( ( ) )
1075+ }
1076+ }
1077+ pub struct NotFoundArgs < ' a > {
1078+ pub instance_id : Option < flatbuffers:: WIPOffset < super :: common:: ContractInstanceId < ' a > > > ,
1079+ }
1080+ impl < ' a > Default for NotFoundArgs < ' a > {
1081+ #[ inline]
1082+ fn default ( ) -> Self {
1083+ NotFoundArgs {
1084+ instance_id : None , // required field
1085+ }
1086+ }
1087+ }
1088+
1089+ pub struct NotFoundBuilder < ' a : ' b , ' b , A : flatbuffers:: Allocator + ' a > {
1090+ fbb_ : & ' b mut flatbuffers:: FlatBufferBuilder < ' a , A > ,
1091+ start_ : flatbuffers:: WIPOffset < flatbuffers:: TableUnfinishedWIPOffset > ,
1092+ }
1093+ impl < ' a : ' b , ' b , A : flatbuffers:: Allocator + ' a > NotFoundBuilder < ' a , ' b , A > {
1094+ #[ inline]
1095+ pub fn add_instance_id (
1096+ & mut self ,
1097+ instance_id : flatbuffers:: WIPOffset < super :: common:: ContractInstanceId < ' b > > ,
1098+ ) {
1099+ self . fbb_
1100+ . push_slot_always :: < flatbuffers:: WIPOffset < super :: common:: ContractInstanceId > > (
1101+ NotFound :: VT_INSTANCE_ID ,
1102+ instance_id,
1103+ ) ;
1104+ }
1105+ #[ inline]
1106+ pub fn new (
1107+ _fbb : & ' b mut flatbuffers:: FlatBufferBuilder < ' a , A > ,
1108+ ) -> NotFoundBuilder < ' a , ' b , A > {
1109+ let start = _fbb. start_table ( ) ;
1110+ NotFoundBuilder {
1111+ fbb_ : _fbb,
1112+ start_ : start,
1113+ }
1114+ }
1115+ #[ inline]
1116+ pub fn finish ( self ) -> flatbuffers:: WIPOffset < NotFound < ' a > > {
1117+ let o = self . fbb_ . end_table ( self . start_ ) ;
1118+ self . fbb_
1119+ . required ( o, NotFound :: VT_INSTANCE_ID , "instance_id" ) ;
1120+ flatbuffers:: WIPOffset :: new ( o. value ( ) )
1121+ }
1122+ }
1123+
1124+ impl core:: fmt:: Debug for NotFound < ' _ > {
1125+ fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
1126+ let mut ds = f. debug_struct ( "NotFound" ) ;
1127+ ds. field ( "instance_id" , & self . instance_id ( ) ) ;
1128+ ds. finish ( )
1129+ }
1130+ }
9991131 pub enum ContractResponseOffset { }
10001132 #[ derive( Copy , Clone , PartialEq ) ]
10011133
@@ -1122,6 +1254,20 @@ pub mod host_response {
11221254 None
11231255 }
11241256 }
1257+
1258+ #[ inline]
1259+ #[ allow( non_snake_case) ]
1260+ pub fn contract_response_as_not_found ( & self ) -> Option < NotFound < ' a > > {
1261+ if self . contract_response_type ( ) == ContractResponseType :: NotFound {
1262+ let u = self . contract_response ( ) ;
1263+ // Safety:
1264+ // Created from a valid Table for this object
1265+ // Which contains a valid union in this slot
1266+ Some ( unsafe { NotFound :: init_from_table ( u) } )
1267+ } else {
1268+ None
1269+ }
1270+ }
11251271 }
11261272
11271273 impl flatbuffers:: Verifiable for ContractResponse < ' _ > {
@@ -1138,6 +1284,7 @@ pub mod host_response {
11381284 ContractResponseType :: PutResponse => v. verify_union_variant :: < flatbuffers:: ForwardsUOffset < PutResponse > > ( "ContractResponseType::PutResponse" , pos) ,
11391285 ContractResponseType :: UpdateNotification => v. verify_union_variant :: < flatbuffers:: ForwardsUOffset < UpdateNotification > > ( "ContractResponseType::UpdateNotification" , pos) ,
11401286 ContractResponseType :: UpdateResponse => v. verify_union_variant :: < flatbuffers:: ForwardsUOffset < UpdateResponse > > ( "ContractResponseType::UpdateResponse" , pos) ,
1287+ ContractResponseType :: NotFound => v. verify_union_variant :: < flatbuffers:: ForwardsUOffset < NotFound > > ( "ContractResponseType::NotFound" , pos) ,
11411288 _ => Ok ( ( ) ) ,
11421289 }
11431290 } ) ?
@@ -1249,6 +1396,16 @@ pub mod host_response {
12491396 )
12501397 }
12511398 }
1399+ ContractResponseType :: NotFound => {
1400+ if let Some ( x) = self . contract_response_as_not_found ( ) {
1401+ ds. field ( "contract_response" , & x)
1402+ } else {
1403+ ds. field (
1404+ "contract_response" ,
1405+ & "InvalidFlatbuffer: Union discriminant does not match value." ,
1406+ )
1407+ }
1408+ }
12521409 _ => {
12531410 let x: Option < ( ) > = None ;
12541411 ds. field ( "contract_response" , & x)
@@ -3338,7 +3495,7 @@ pub mod host_response {
33383495 /// `root_as_host_response_unchecked`.
33393496 pub fn root_as_host_response (
33403497 buf : & [ u8 ] ,
3341- ) -> Result < HostResponse < ' _ > , flatbuffers:: InvalidFlatbuffer > {
3498+ ) -> Result < HostResponse , flatbuffers:: InvalidFlatbuffer > {
33423499 flatbuffers:: root :: < HostResponse > ( buf)
33433500 }
33443501 #[ inline]
@@ -3350,7 +3507,7 @@ pub mod host_response {
33503507 /// `size_prefixed_root_as_host_response_unchecked`.
33513508 pub fn size_prefixed_root_as_host_response (
33523509 buf : & [ u8 ] ,
3353- ) -> Result < HostResponse < ' _ > , flatbuffers:: InvalidFlatbuffer > {
3510+ ) -> Result < HostResponse , flatbuffers:: InvalidFlatbuffer > {
33543511 flatbuffers:: size_prefixed_root :: < HostResponse > ( buf)
33553512 }
33563513 #[ inline]
@@ -3383,14 +3540,14 @@ pub mod host_response {
33833540 /// Assumes, without verification, that a buffer of bytes contains a HostResponse and returns it.
33843541 /// # Safety
33853542 /// Callers must trust the given bytes do indeed contain a valid `HostResponse`.
3386- pub unsafe fn root_as_host_response_unchecked ( buf : & [ u8 ] ) -> HostResponse < ' _ > {
3543+ pub unsafe fn root_as_host_response_unchecked ( buf : & [ u8 ] ) -> HostResponse {
33873544 flatbuffers:: root_unchecked :: < HostResponse > ( buf)
33883545 }
33893546 #[ inline]
33903547 /// Assumes, without verification, that a buffer of bytes contains a size prefixed HostResponse and returns it.
33913548 /// # Safety
33923549 /// Callers must trust the given bytes do indeed contain a valid size prefixed `HostResponse`.
3393- pub unsafe fn size_prefixed_root_as_host_response_unchecked ( buf : & [ u8 ] ) -> HostResponse < ' _ > {
3550+ pub unsafe fn size_prefixed_root_as_host_response_unchecked ( buf : & [ u8 ] ) -> HostResponse {
33943551 flatbuffers:: size_prefixed_root_unchecked :: < HostResponse > ( buf)
33953552 }
33963553 #[ inline]
0 commit comments