@@ -20,11 +20,8 @@ impl Type<Sqlite> for [u8] {
20
20
}
21
21
22
22
impl < ' q > Encode < ' q , Sqlite > for & ' q [ u8 ] {
23
- fn encode_by_ref (
24
- & self ,
25
- args : & mut Vec < SqliteArgumentValue < ' q > > ,
26
- ) -> Result < IsNull , BoxDynError > {
27
- args. push ( SqliteArgumentValue :: Blob ( Cow :: Borrowed ( self ) ) ) ;
23
+ fn encode_by_ref ( & self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
24
+ args. push ( SqliteArgumentValue :: Blob ( self . to_vec ( ) ) ) ;
28
25
29
26
Ok ( IsNull :: No )
30
27
}
@@ -37,19 +34,14 @@ impl<'r> Decode<'r, Sqlite> for &'r [u8] {
37
34
}
38
35
39
36
impl Encode < ' _ , Sqlite > for Box < [ u8 ] > {
40
- fn encode ( self , args : & mut Vec < SqliteArgumentValue < ' _ > > ) -> Result < IsNull , BoxDynError > {
41
- args. push ( SqliteArgumentValue :: Blob ( Cow :: Owned ( self . into_vec ( ) ) ) ) ;
37
+ fn encode ( self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
38
+ args. push ( SqliteArgumentValue :: Blob ( self . into_vec ( ) ) ) ;
42
39
43
40
Ok ( IsNull :: No )
44
41
}
45
42
46
- fn encode_by_ref (
47
- & self ,
48
- args : & mut Vec < SqliteArgumentValue < ' _ > > ,
49
- ) -> Result < IsNull , BoxDynError > {
50
- args. push ( SqliteArgumentValue :: Blob ( Cow :: Owned (
51
- self . clone ( ) . into_vec ( ) ,
52
- ) ) ) ;
43
+ fn encode_by_ref ( & self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
44
+ args. push ( SqliteArgumentValue :: Blob ( self . clone ( ) . into_vec ( ) ) ) ;
53
45
54
46
Ok ( IsNull :: No )
55
47
}
@@ -66,17 +58,14 @@ impl Type<Sqlite> for Vec<u8> {
66
58
}
67
59
68
60
impl < ' q > Encode < ' q , Sqlite > for Vec < u8 > {
69
- fn encode ( self , args : & mut Vec < SqliteArgumentValue < ' q > > ) -> Result < IsNull , BoxDynError > {
70
- args. push ( SqliteArgumentValue :: Blob ( Cow :: Owned ( self ) ) ) ;
61
+ fn encode ( self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
62
+ args. push ( SqliteArgumentValue :: Blob ( self ) ) ;
71
63
72
64
Ok ( IsNull :: No )
73
65
}
74
66
75
- fn encode_by_ref (
76
- & self ,
77
- args : & mut Vec < SqliteArgumentValue < ' q > > ,
78
- ) -> Result < IsNull , BoxDynError > {
79
- args. push ( SqliteArgumentValue :: Blob ( Cow :: Owned ( self . clone ( ) ) ) ) ;
67
+ fn encode_by_ref ( & self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
68
+ args. push ( SqliteArgumentValue :: Blob ( self . clone ( ) ) ) ;
80
69
81
70
Ok ( IsNull :: No )
82
71
}
@@ -89,36 +78,27 @@ impl<'r> Decode<'r, Sqlite> for Vec<u8> {
89
78
}
90
79
91
80
impl < ' q > Encode < ' q , Sqlite > for Cow < ' q , [ u8 ] > {
92
- fn encode ( self , args : & mut Vec < SqliteArgumentValue < ' q > > ) -> Result < IsNull , BoxDynError > {
93
- args. push ( SqliteArgumentValue :: Blob ( self ) ) ;
81
+ fn encode ( self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
82
+ args. push ( SqliteArgumentValue :: Blob ( self . to_vec ( ) ) ) ;
94
83
95
84
Ok ( IsNull :: No )
96
85
}
97
86
98
- fn encode_by_ref (
99
- & self ,
100
- args : & mut Vec < SqliteArgumentValue < ' q > > ,
101
- ) -> Result < IsNull , BoxDynError > {
102
- args. push ( SqliteArgumentValue :: Blob ( self . clone ( ) ) ) ;
87
+ fn encode_by_ref ( & self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
88
+ args. push ( SqliteArgumentValue :: Blob ( self . to_vec ( ) ) ) ;
103
89
104
90
Ok ( IsNull :: No )
105
91
}
106
92
}
107
93
108
94
impl < ' q > Encode < ' q , Sqlite > for Arc < [ u8 ] > {
109
- fn encode_by_ref (
110
- & self ,
111
- args : & mut Vec < SqliteArgumentValue < ' q > > ,
112
- ) -> Result < IsNull , BoxDynError > {
95
+ fn encode_by_ref ( & self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
113
96
<Vec < u8 > as Encode < ' _ , Sqlite > >:: encode ( self . to_vec ( ) , args)
114
97
}
115
98
}
116
99
117
100
impl < ' q > Encode < ' q , Sqlite > for Rc < [ u8 ] > {
118
- fn encode_by_ref (
119
- & self ,
120
- args : & mut Vec < SqliteArgumentValue < ' q > > ,
121
- ) -> Result < IsNull , BoxDynError > {
101
+ fn encode_by_ref ( & self , args : & mut Vec < SqliteArgumentValue > ) -> Result < IsNull , BoxDynError > {
122
102
<Vec < u8 > as Encode < ' _ , Sqlite > >:: encode ( self . to_vec ( ) , args)
123
103
}
124
104
}
0 commit comments