@@ -5,116 +5,128 @@ extern crate flatbuffers;
55use alloc:: boxed:: Box ;
66use alloc:: string:: { String , ToString } ;
77use alloc:: vec:: Vec ;
8- use core:: mem;
98use core:: cmp:: Ordering ;
9+ use core:: mem;
10+
1011use self :: flatbuffers:: { EndianScalar , Follow } ;
1112use super :: * ;
12- #[ deprecated( since = "2.0.0" , note = "Use associated constants instead. This will no longer be generated in 2021." ) ]
13+ #[ deprecated(
14+ since = "2.0.0" ,
15+ note = "Use associated constants instead. This will no longer be generated in 2021."
16+ ) ]
1317pub const ENUM_MIN_ERROR_CODE : u64 = 0 ;
14- #[ deprecated( since = "2.0.0" , note = "Use associated constants instead. This will no longer be generated in 2021." ) ]
18+ #[ deprecated(
19+ since = "2.0.0" ,
20+ note = "Use associated constants instead. This will no longer be generated in 2021."
21+ ) ]
1522pub const ENUM_MAX_ERROR_CODE : u64 = 16 ;
16- #[ deprecated( since = "2.0.0" , note = "Use associated constants instead. This will no longer be generated in 2021." ) ]
23+ #[ deprecated(
24+ since = "2.0.0" ,
25+ note = "Use associated constants instead. This will no longer be generated in 2021."
26+ ) ]
1727#[ allow( non_camel_case_types) ]
1828pub const ENUM_VALUES_ERROR_CODE : [ ErrorCode ; 16 ] = [
19- ErrorCode :: NoError ,
20- ErrorCode :: UnsupportedParameterType ,
21- ErrorCode :: GuestFunctionNameNotProvided ,
22- ErrorCode :: GuestFunctionNotFound ,
23- ErrorCode :: GuestFunctionIncorrecNoOfParameters ,
24- ErrorCode :: GispatchFunctionPointerNotSet ,
25- ErrorCode :: OutbError ,
26- ErrorCode :: UnknownError ,
27- ErrorCode :: StackOverflow ,
28- ErrorCode :: GsCheckFailed ,
29- ErrorCode :: TooManyGuestFunctions ,
30- ErrorCode :: FailureInDlmalloc ,
31- ErrorCode :: MallocFailed ,
32- ErrorCode :: GuestFunctionParameterTypeMismatch ,
33- ErrorCode :: GuestError ,
34- ErrorCode :: ArrayLengthParamIsMissing ,
29+ ErrorCode :: NoError ,
30+ ErrorCode :: UnsupportedParameterType ,
31+ ErrorCode :: GuestFunctionNameNotProvided ,
32+ ErrorCode :: GuestFunctionNotFound ,
33+ ErrorCode :: GuestFunctionIncorrecNoOfParameters ,
34+ ErrorCode :: GispatchFunctionPointerNotSet ,
35+ ErrorCode :: OutbError ,
36+ ErrorCode :: UnknownError ,
37+ ErrorCode :: StackOverflow ,
38+ ErrorCode :: GsCheckFailed ,
39+ ErrorCode :: TooManyGuestFunctions ,
40+ ErrorCode :: FailureInDlmalloc ,
41+ ErrorCode :: MallocFailed ,
42+ ErrorCode :: GuestFunctionParameterTypeMismatch ,
43+ ErrorCode :: GuestError ,
44+ ErrorCode :: ArrayLengthParamIsMissing ,
3545] ;
3646
3747#[ derive( Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash , Default ) ]
3848#[ repr( transparent) ]
3949pub struct ErrorCode ( pub u64 ) ;
4050#[ allow( non_upper_case_globals) ]
4151impl ErrorCode {
42- pub const NoError : Self = Self ( 0 ) ;
43- pub const UnsupportedParameterType : Self = Self ( 2 ) ;
44- pub const GuestFunctionNameNotProvided : Self = Self ( 3 ) ;
45- pub const GuestFunctionNotFound : Self = Self ( 4 ) ;
46- pub const GuestFunctionIncorrecNoOfParameters : Self = Self ( 5 ) ;
47- pub const GispatchFunctionPointerNotSet : Self = Self ( 6 ) ;
48- pub const OutbError : Self = Self ( 7 ) ;
49- pub const UnknownError : Self = Self ( 8 ) ;
50- pub const StackOverflow : Self = Self ( 9 ) ;
51- pub const GsCheckFailed : Self = Self ( 10 ) ;
52- pub const TooManyGuestFunctions : Self = Self ( 11 ) ;
53- pub const FailureInDlmalloc : Self = Self ( 12 ) ;
54- pub const MallocFailed : Self = Self ( 13 ) ;
55- pub const GuestFunctionParameterTypeMismatch : Self = Self ( 14 ) ;
56- pub const GuestError : Self = Self ( 15 ) ;
57- pub const ArrayLengthParamIsMissing : Self = Self ( 16 ) ;
52+ pub const NoError : Self = Self ( 0 ) ;
53+ pub const UnsupportedParameterType : Self = Self ( 2 ) ;
54+ pub const GuestFunctionNameNotProvided : Self = Self ( 3 ) ;
55+ pub const GuestFunctionNotFound : Self = Self ( 4 ) ;
56+ pub const GuestFunctionIncorrecNoOfParameters : Self = Self ( 5 ) ;
57+ pub const GispatchFunctionPointerNotSet : Self = Self ( 6 ) ;
58+ pub const OutbError : Self = Self ( 7 ) ;
59+ pub const UnknownError : Self = Self ( 8 ) ;
60+ pub const StackOverflow : Self = Self ( 9 ) ;
61+ pub const GsCheckFailed : Self = Self ( 10 ) ;
62+ pub const TooManyGuestFunctions : Self = Self ( 11 ) ;
63+ pub const FailureInDlmalloc : Self = Self ( 12 ) ;
64+ pub const MallocFailed : Self = Self ( 13 ) ;
65+ pub const GuestFunctionParameterTypeMismatch : Self = Self ( 14 ) ;
66+ pub const GuestError : Self = Self ( 15 ) ;
67+ pub const ArrayLengthParamIsMissing : Self = Self ( 16 ) ;
5868
59- pub const ENUM_MIN : u64 = 0 ;
60- pub const ENUM_MAX : u64 = 16 ;
61- pub const ENUM_VALUES : & ' static [ Self ] = & [
62- Self :: NoError ,
63- Self :: UnsupportedParameterType ,
64- Self :: GuestFunctionNameNotProvided ,
65- Self :: GuestFunctionNotFound ,
66- Self :: GuestFunctionIncorrecNoOfParameters ,
67- Self :: GispatchFunctionPointerNotSet ,
68- Self :: OutbError ,
69- Self :: UnknownError ,
70- Self :: StackOverflow ,
71- Self :: GsCheckFailed ,
72- Self :: TooManyGuestFunctions ,
73- Self :: FailureInDlmalloc ,
74- Self :: MallocFailed ,
75- Self :: GuestFunctionParameterTypeMismatch ,
76- Self :: GuestError ,
77- Self :: ArrayLengthParamIsMissing ,
78- ] ;
79- /// Returns the variant's name or "" if unknown.
80- pub fn variant_name ( self ) -> Option < & ' static str > {
81- match self {
82- Self :: NoError => Some ( "NoError" ) ,
83- Self :: UnsupportedParameterType => Some ( "UnsupportedParameterType" ) ,
84- Self :: GuestFunctionNameNotProvided => Some ( "GuestFunctionNameNotProvided" ) ,
85- Self :: GuestFunctionNotFound => Some ( "GuestFunctionNotFound" ) ,
86- Self :: GuestFunctionIncorrecNoOfParameters => Some ( "GuestFunctionIncorrecNoOfParameters" ) ,
87- Self :: GispatchFunctionPointerNotSet => Some ( "GispatchFunctionPointerNotSet" ) ,
88- Self :: OutbError => Some ( "OutbError" ) ,
89- Self :: UnknownError => Some ( "UnknownError" ) ,
90- Self :: StackOverflow => Some ( "StackOverflow" ) ,
91- Self :: GsCheckFailed => Some ( "GsCheckFailed" ) ,
92- Self :: TooManyGuestFunctions => Some ( "TooManyGuestFunctions" ) ,
93- Self :: FailureInDlmalloc => Some ( "FailureInDlmalloc" ) ,
94- Self :: MallocFailed => Some ( "MallocFailed" ) ,
95- Self :: GuestFunctionParameterTypeMismatch => Some ( "GuestFunctionParameterTypeMismatch" ) ,
96- Self :: GuestError => Some ( "GuestError" ) ,
97- Self :: ArrayLengthParamIsMissing => Some ( "ArrayLengthParamIsMissing" ) ,
98- _ => None ,
69+ pub const ENUM_MIN : u64 = 0 ;
70+ pub const ENUM_MAX : u64 = 16 ;
71+ pub const ENUM_VALUES : & ' static [ Self ] = & [
72+ Self :: NoError ,
73+ Self :: UnsupportedParameterType ,
74+ Self :: GuestFunctionNameNotProvided ,
75+ Self :: GuestFunctionNotFound ,
76+ Self :: GuestFunctionIncorrecNoOfParameters ,
77+ Self :: GispatchFunctionPointerNotSet ,
78+ Self :: OutbError ,
79+ Self :: UnknownError ,
80+ Self :: StackOverflow ,
81+ Self :: GsCheckFailed ,
82+ Self :: TooManyGuestFunctions ,
83+ Self :: FailureInDlmalloc ,
84+ Self :: MallocFailed ,
85+ Self :: GuestFunctionParameterTypeMismatch ,
86+ Self :: GuestError ,
87+ Self :: ArrayLengthParamIsMissing ,
88+ ] ;
89+ /// Returns the variant's name or "" if unknown.
90+ pub fn variant_name ( self ) -> Option < & ' static str > {
91+ match self {
92+ Self :: NoError => Some ( "NoError" ) ,
93+ Self :: UnsupportedParameterType => Some ( "UnsupportedParameterType" ) ,
94+ Self :: GuestFunctionNameNotProvided => Some ( "GuestFunctionNameNotProvided" ) ,
95+ Self :: GuestFunctionNotFound => Some ( "GuestFunctionNotFound" ) ,
96+ Self :: GuestFunctionIncorrecNoOfParameters => {
97+ Some ( "GuestFunctionIncorrecNoOfParameters" )
98+ }
99+ Self :: GispatchFunctionPointerNotSet => Some ( "GispatchFunctionPointerNotSet" ) ,
100+ Self :: OutbError => Some ( "OutbError" ) ,
101+ Self :: UnknownError => Some ( "UnknownError" ) ,
102+ Self :: StackOverflow => Some ( "StackOverflow" ) ,
103+ Self :: GsCheckFailed => Some ( "GsCheckFailed" ) ,
104+ Self :: TooManyGuestFunctions => Some ( "TooManyGuestFunctions" ) ,
105+ Self :: FailureInDlmalloc => Some ( "FailureInDlmalloc" ) ,
106+ Self :: MallocFailed => Some ( "MallocFailed" ) ,
107+ Self :: GuestFunctionParameterTypeMismatch => Some ( "GuestFunctionParameterTypeMismatch" ) ,
108+ Self :: GuestError => Some ( "GuestError" ) ,
109+ Self :: ArrayLengthParamIsMissing => Some ( "ArrayLengthParamIsMissing" ) ,
110+ _ => None ,
111+ }
99112 }
100- }
101113}
102114impl core:: fmt:: Debug for ErrorCode {
103- fn fmt ( & self , f : & mut core:: fmt:: Formatter ) -> core:: fmt:: Result {
104- if let Some ( name) = self . variant_name ( ) {
105- f. write_str ( name)
106- } else {
107- f. write_fmt ( format_args ! ( "<UNKNOWN {:?}>" , self . 0 ) )
115+ fn fmt ( & self , f : & mut core:: fmt:: Formatter ) -> core:: fmt:: Result {
116+ if let Some ( name) = self . variant_name ( ) {
117+ f. write_str ( name)
118+ } else {
119+ f. write_fmt ( format_args ! ( "<UNKNOWN {:?}>" , self . 0 ) )
120+ }
108121 }
109- }
110122}
111123impl < ' a > flatbuffers:: Follow < ' a > for ErrorCode {
112- type Inner = Self ;
113- #[ inline]
114- unsafe fn follow ( buf : & ' a [ u8 ] , loc : usize ) -> Self :: Inner {
115- let b = flatbuffers:: read_scalar_at :: < u64 > ( buf, loc) ;
116- Self ( b)
117- }
124+ type Inner = Self ;
125+ #[ inline]
126+ unsafe fn follow ( buf : & ' a [ u8 ] , loc : usize ) -> Self :: Inner {
127+ let b = flatbuffers:: read_scalar_at :: < u64 > ( buf, loc) ;
128+ Self ( b)
129+ }
118130}
119131
120132impl flatbuffers:: Push for ErrorCode {
@@ -126,27 +138,28 @@ impl flatbuffers::Push for ErrorCode {
126138}
127139
128140impl flatbuffers:: EndianScalar for ErrorCode {
129- type Scalar = u64 ;
130- #[ inline]
131- fn to_little_endian ( self ) -> u64 {
132- self . 0 . to_le ( )
133- }
134- #[ inline]
135- #[ allow( clippy:: wrong_self_convention) ]
136- fn from_little_endian ( v : u64 ) -> Self {
137- let b = u64:: from_le ( v) ;
138- Self ( b)
139- }
141+ type Scalar = u64 ;
142+ #[ inline]
143+ fn to_little_endian ( self ) -> u64 {
144+ self . 0 . to_le ( )
145+ }
146+ #[ inline]
147+ #[ allow( clippy:: wrong_self_convention) ]
148+ fn from_little_endian ( v : u64 ) -> Self {
149+ let b = u64:: from_le ( v) ;
150+ Self ( b)
151+ }
140152}
141153
142154impl < ' a > flatbuffers:: Verifiable for ErrorCode {
143- #[ inline]
144- fn run_verifier (
145- v : & mut flatbuffers:: Verifier , pos : usize
146- ) -> Result < ( ) , flatbuffers:: InvalidFlatbuffer > {
147- use self :: flatbuffers:: Verifiable ;
148- u64:: run_verifier ( v, pos)
149- }
155+ #[ inline]
156+ fn run_verifier (
157+ v : & mut flatbuffers:: Verifier ,
158+ pos : usize ,
159+ ) -> Result < ( ) , flatbuffers:: InvalidFlatbuffer > {
160+ use self :: flatbuffers:: Verifiable ;
161+ u64:: run_verifier ( v, pos)
162+ }
150163}
151164
152165impl flatbuffers:: SimpleToVerifyInSlice for ErrorCode { }
0 commit comments