@@ -2,6 +2,7 @@ use std::borrow::Cow;
2
2
use std:: rc:: Rc ;
3
3
use std:: sync:: Arc ;
4
4
5
+ use crate :: arguments:: SqliteArgumentsBuffer ;
5
6
use crate :: decode:: Decode ;
6
7
use crate :: encode:: { Encode , IsNull } ;
7
8
use crate :: error:: BoxDynError ;
@@ -20,7 +21,7 @@ impl Type<Sqlite> for [u8] {
20
21
}
21
22
22
23
impl Encode < ' _ , Sqlite > for & ' _ [ u8 ] {
23
- fn encode_by_ref ( & self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
24
+ fn encode_by_ref ( & self , args : & mut SqliteArgumentsBuffer ) -> Result < IsNull , BoxDynError > {
24
25
args. push ( SqliteArgumentValue :: Blob ( self . to_vec ( ) ) ) ;
25
26
26
27
Ok ( IsNull :: No )
@@ -34,13 +35,13 @@ impl<'r> Decode<'r, Sqlite> for &'r [u8] {
34
35
}
35
36
36
37
impl Encode < ' _ , Sqlite > for Box < [ u8 ] > {
37
- fn encode ( self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
38
+ fn encode ( self , args : & mut SqliteArgumentsBuffer ) -> Result < IsNull , BoxDynError > {
38
39
args. push ( SqliteArgumentValue :: Blob ( self . into_vec ( ) ) ) ;
39
40
40
41
Ok ( IsNull :: No )
41
42
}
42
43
43
- fn encode_by_ref ( & self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
44
+ fn encode_by_ref ( & self , args : & mut SqliteArgumentsBuffer ) -> Result < IsNull , BoxDynError > {
44
45
args. push ( SqliteArgumentValue :: Blob ( self . clone ( ) . into_vec ( ) ) ) ;
45
46
46
47
Ok ( IsNull :: No )
@@ -58,13 +59,13 @@ impl Type<Sqlite> for Vec<u8> {
58
59
}
59
60
60
61
impl Encode < ' _ , Sqlite > for Vec < u8 > {
61
- fn encode ( self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
62
+ fn encode ( self , args : & mut SqliteArgumentsBuffer ) -> Result < IsNull , BoxDynError > {
62
63
args. push ( SqliteArgumentValue :: Blob ( self ) ) ;
63
64
64
65
Ok ( IsNull :: No )
65
66
}
66
67
67
- fn encode_by_ref ( & self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
68
+ fn encode_by_ref ( & self , args : & mut SqliteArgumentsBuffer ) -> Result < IsNull , BoxDynError > {
68
69
args. push ( SqliteArgumentValue :: Blob ( self . clone ( ) ) ) ;
69
70
70
71
Ok ( IsNull :: No )
@@ -78,27 +79,27 @@ impl<'r> Decode<'r, Sqlite> for Vec<u8> {
78
79
}
79
80
80
81
impl Encode < ' _ , Sqlite > for Cow < ' _ , [ u8 ] > {
81
- fn encode ( self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
82
+ fn encode ( self , args : & mut SqliteArgumentsBuffer ) -> Result < IsNull , BoxDynError > {
82
83
args. push ( SqliteArgumentValue :: Blob ( self . to_vec ( ) ) ) ;
83
84
84
85
Ok ( IsNull :: No )
85
86
}
86
87
87
- fn encode_by_ref ( & self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
88
+ fn encode_by_ref ( & self , args : & mut SqliteArgumentsBuffer ) -> Result < IsNull , BoxDynError > {
88
89
args. push ( SqliteArgumentValue :: Blob ( self . to_vec ( ) ) ) ;
89
90
90
91
Ok ( IsNull :: No )
91
92
}
92
93
}
93
94
94
95
impl Encode < ' _ , Sqlite > for Arc < [ u8 ] > {
95
- fn encode_by_ref ( & self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
96
+ fn encode_by_ref ( & self , args : & mut SqliteArgumentsBuffer ) -> Result < IsNull , BoxDynError > {
96
97
<Vec < u8 > as Encode < ' _ , Sqlite > >:: encode ( self . to_vec ( ) , args)
97
98
}
98
99
}
99
100
100
101
impl Encode < ' _ , Sqlite > for Rc < [ u8 ] > {
101
- fn encode_by_ref ( & self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
102
+ fn encode_by_ref ( & self , args : & mut SqliteArgumentsBuffer ) -> Result < IsNull , BoxDynError > {
102
103
<Vec < u8 > as Encode < ' _ , Sqlite > >:: encode ( self . to_vec ( ) , args)
103
104
}
104
105
}
0 commit comments