@@ -2,7 +2,7 @@ use crate::db::raw_def::v9::RawModuleDefV9Builder;
2
2
use crate :: db:: raw_def:: RawTableDefV8 ;
3
3
use anyhow:: Context ;
4
4
use sats:: typespace:: TypespaceBuilder ;
5
- use spacetimedb_sats:: { impl_serialize , WithTypespace } ;
5
+ use spacetimedb_sats:: WithTypespace ;
6
6
use std:: any:: TypeId ;
7
7
use std:: collections:: { btree_map, BTreeMap } ;
8
8
@@ -126,68 +126,6 @@ pub struct ReducerDef {
126
126
pub args : Vec < ProductTypeElement > ,
127
127
}
128
128
129
- impl ReducerDef {
130
- pub fn encode ( & self , writer : & mut impl buffer:: BufWriter ) {
131
- bsatn:: to_writer ( writer, self ) . unwrap ( )
132
- }
133
-
134
- pub fn serialize_args < ' a > ( ty : sats:: WithTypespace < ' a , Self > , value : & ' a ProductValue ) -> impl ser:: Serialize + ' a {
135
- ReducerArgsWithSchema { value, ty }
136
- }
137
-
138
- pub fn deserialize (
139
- ty : sats:: WithTypespace < ' _ , Self > ,
140
- ) -> impl for < ' de > de:: DeserializeSeed < ' de , Output = ProductValue > + ' _ {
141
- ReducerDeserialize ( ty)
142
- }
143
- }
144
-
145
- struct ReducerDeserialize < ' a > ( sats:: WithTypespace < ' a , ReducerDef > ) ;
146
-
147
- impl < ' de > de:: DeserializeSeed < ' de > for ReducerDeserialize < ' _ > {
148
- type Output = ProductValue ;
149
-
150
- fn deserialize < D : de:: Deserializer < ' de > > ( self , deserializer : D ) -> Result < Self :: Output , D :: Error > {
151
- deserializer. deserialize_product ( self )
152
- }
153
- }
154
-
155
- impl < ' de > de:: ProductVisitor < ' de > for ReducerDeserialize < ' _ > {
156
- type Output = ProductValue ;
157
-
158
- fn product_name ( & self ) -> Option < & str > {
159
- Some ( & self . 0 . ty ( ) . name )
160
- }
161
- fn product_len ( & self ) -> usize {
162
- self . 0 . ty ( ) . args . len ( )
163
- }
164
- fn product_kind ( & self ) -> de:: ProductKind {
165
- de:: ProductKind :: ReducerArgs
166
- }
167
-
168
- fn visit_seq_product < A : de:: SeqProductAccess < ' de > > ( self , tup : A ) -> Result < Self :: Output , A :: Error > {
169
- de:: visit_seq_product ( self . 0 . map ( |r| & * r. args ) , & self , tup)
170
- }
171
-
172
- fn visit_named_product < A : de:: NamedProductAccess < ' de > > ( self , tup : A ) -> Result < Self :: Output , A :: Error > {
173
- de:: visit_named_product ( self . 0 . map ( |r| & * r. args ) , & self , tup)
174
- }
175
- }
176
-
177
- struct ReducerArgsWithSchema < ' a > {
178
- value : & ' a ProductValue ,
179
- ty : sats:: WithTypespace < ' a , ReducerDef > ,
180
- }
181
- impl_serialize ! ( [ ] ReducerArgsWithSchema <' _>, ( self , ser) => {
182
- use itertools:: Itertools ;
183
- use ser:: SerializeSeqProduct ;
184
- let mut seq = ser. serialize_seq_product( self . value. elements. len( ) ) ?;
185
- for ( value, elem) in self . value. elements. iter( ) . zip_eq( & self . ty. ty( ) . args) {
186
- seq. serialize_element( & self . ty. with( & elem. algebraic_type) . with_value( value) ) ?;
187
- }
188
- seq. end( )
189
- } ) ;
190
-
191
129
//WARNING: Change this structure (or any of their members) is an ABI change.
192
130
#[ derive( Debug , Clone , Default , SpacetimeType ) ]
193
131
#[ cfg_attr( feature = "test" , derive( PartialEq , Eq , PartialOrd , Ord ) ) ]
0 commit comments