1
1
use rustler:: types:: atom:: Atom ;
2
- use rustler:: { Decoder , Encoder , Env , Term } ;
3
- use rustler:: { NifResult , NifStruct , NifTaggedEnum , NifUntaggedEnum } ;
2
+ use rustler:: { NifStruct , NifTaggedEnum , NifUntaggedEnum } ;
4
3
// use rustler::{map}
5
4
mod type_atoms {
6
5
rustler:: atoms! {
@@ -162,7 +161,7 @@ impl From<Expr> for sqlparser::ast::Expr {
162
161
) ) ,
163
162
ExprEnum :: UnaryOp ( op) => sqlparser:: ast:: Expr :: UnaryOp {
164
163
expr : Box :: new ( sqlparser:: ast:: Expr :: from ( * op. expr . clone ( ) ) ) ,
165
- op : sqlparser:: ast:: UnaryOperator :: from ( op. op )
164
+ op : sqlparser:: ast:: UnaryOperator :: from ( op. op ) ,
166
165
} ,
167
166
ExprEnum :: SimilarTo ( ..)
168
167
| ExprEnum :: Nested ( ..)
@@ -175,10 +174,12 @@ impl From<Expr> for sqlparser::ast::Expr {
175
174
| ExprEnum :: InList ( ..)
176
175
| ExprEnum :: AllOp ( ..)
177
176
| ExprEnum :: AnyOp ( ..)
178
- | ExprEnum :: CompositeAccess ( ..) => sqlparser:: ast:: Expr :: Identifier ( sqlparser:: ast:: Ident {
179
- value : "abd" . to_string ( ) ,
180
- quote_style : None ,
181
- } ) ,
177
+ | ExprEnum :: CompositeAccess ( ..) => {
178
+ sqlparser:: ast:: Expr :: Identifier ( sqlparser:: ast:: Ident {
179
+ value : "abd" . to_string ( ) ,
180
+ quote_style : None ,
181
+ } )
182
+ }
182
183
}
183
184
}
184
185
}
@@ -245,7 +246,7 @@ impl From<TableFactor> for sqlparser::ast::TableFactor {
245
246
impl From < JoinOperator > for sqlparser:: ast:: JoinOperator {
246
247
fn from ( join_operator : JoinOperator ) -> Self {
247
248
match join_operator {
248
- _ => sqlparser:: ast:: JoinOperator :: CrossJoin
249
+ _ => sqlparser:: ast:: JoinOperator :: CrossJoin ,
249
250
}
250
251
}
251
252
}
@@ -261,7 +262,11 @@ impl From<TableWithJoins> for sqlparser::ast::TableWithJoins {
261
262
fn from ( table_with_joins : TableWithJoins ) -> Self {
262
263
sqlparser:: ast:: TableWithJoins {
263
264
relation : sqlparser:: ast:: TableFactor :: from ( table_with_joins. relation ) ,
264
- joins : table_with_joins. joins . iter ( ) . map ( |j| sqlparser:: ast:: Join :: from ( j. clone ( ) ) ) . collect ( ) ,
265
+ joins : table_with_joins
266
+ . joins
267
+ . iter ( )
268
+ . map ( |j| sqlparser:: ast:: Join :: from ( j. clone ( ) ) )
269
+ . collect ( ) ,
265
270
}
266
271
}
267
272
}
@@ -416,17 +421,6 @@ pub enum SetExpr {
416
421
// Insert(Statement),
417
422
NotImplemented ( Atom ) ,
418
423
}
419
- impl Encoder for Box < SetExpr > {
420
- fn encode < ' a > ( & self , env : Env < ' a > ) -> Term < ' a > {
421
- let data = & * * self ;
422
- data. encode ( env)
423
- }
424
- }
425
- impl Decoder < ' _ > for Box < SetExpr > {
426
- fn decode < ' a > ( _term : Term < ' a > ) -> NifResult < Self > {
427
- Err ( rustler:: error:: Error :: BadArg )
428
- }
429
- }
430
424
431
425
#[ derive( NifStruct ) ]
432
426
#[ module = "SqlParser.Wildcard" ]
@@ -979,21 +973,6 @@ pub struct Expr {
979
973
value : ExprEnum ,
980
974
}
981
975
982
- impl Encoder for Box < Expr > {
983
- fn encode < ' a > ( & self , env : Env < ' a > ) -> Term < ' a > {
984
- let data = & * * self ;
985
- data. encode ( env)
986
- }
987
- }
988
- impl Decoder < ' _ > for Box < Expr > {
989
- fn decode < ' a > ( term : Term < ' a > ) -> NifResult < Self > {
990
- let expr: Expr = term. decode ( ) ?;
991
- println ! ( "{:#?}" , term) ;
992
- // println!("{:#?}", expr);
993
- // Err(rustler::error::Error::BadArg)
994
- Ok ( Box :: new ( expr) )
995
- }
996
- }
997
976
impl Expr {
998
977
pub fn new ( ast : sqlparser:: ast:: Expr ) -> Self {
999
978
match ast {
@@ -1321,17 +1300,6 @@ pub enum OffsetRows {
1321
1300
Rows ,
1322
1301
}
1323
1302
1324
- impl Encoder for Box < Query > {
1325
- fn encode < ' a > ( & self , env : Env < ' a > ) -> Term < ' a > {
1326
- let data = & * * self ;
1327
- data. encode ( env)
1328
- }
1329
- }
1330
- impl Decoder < ' _ > for Box < Query > {
1331
- fn decode < ' a > ( _term : Term < ' a > ) -> NifResult < Self > {
1332
- Err ( rustler:: error:: Error :: BadArg )
1333
- }
1334
- }
1335
1303
impl From < sqlparser:: ast:: SetExpr > for SetExpr {
1336
1304
fn from ( set_expr : sqlparser:: ast:: SetExpr ) -> Self {
1337
1305
match set_expr {
0 commit comments