@@ -6,7 +6,7 @@ use types::{Point, LineString, Polygon};
6
6
use ewkb:: { self , EwkbRead , EwkbWrite , AsEwkbPoint , AsEwkbLineString , AsEwkbPolygon , AsEwkbMultiPoint , AsEwkbMultiLineString , AsEwkbMultiPolygon } ;
7
7
use twkb:: { self , TwkbGeom } ;
8
8
use std:: io:: Cursor ;
9
- use postgres:: types:: { Type , IsNull , ToSql , FromSql , SessionInfo } ;
9
+ use postgres:: types:: { Type , IsNull , ToSql , FromSql } ;
10
10
use std:: error:: Error ;
11
11
12
12
@@ -26,7 +26,7 @@ macro_rules! accepts_geography {
26
26
impl < ' a > ToSql for ewkb:: EwkbPoint < ' a > {
27
27
to_sql_checked ! ( ) ;
28
28
accepts_geography ! ( ) ;
29
- fn to_sql ( & self , _: & Type , out : & mut Vec < u8 > , _ctx : & SessionInfo ) -> Result < IsNull , Box < Error + Sync + Send > > {
29
+ fn to_sql ( & self , _: & Type , out : & mut Vec < u8 > ) -> Result < IsNull , Box < Error + Sync + Send > > {
30
30
self . write_ewkb ( out) ?;
31
31
Ok ( IsNull :: No )
32
32
}
@@ -36,7 +36,7 @@ macro_rules! impl_sql_for_point_type {
36
36
( $ptype: ident) => (
37
37
impl FromSql for ewkb:: $ptype {
38
38
accepts_geography!( ) ;
39
- fn from_sql( ty: & Type , raw: & [ u8 ] , _ctx : & SessionInfo ) -> Result <Self , Box <Error + Sync + Send >> {
39
+ fn from_sql( ty: & Type , raw: & [ u8 ] ) -> Result <Self , Box <Error + Sync + Send >> {
40
40
let mut rdr = Cursor :: new( raw) ;
41
41
ewkb:: $ptype:: read_ewkb( & mut rdr) . map_err( |_| format!( "cannot convert {} to {}" , ty, stringify!( $ptype) ) . into( ) )
42
42
}
@@ -45,7 +45,7 @@ macro_rules! impl_sql_for_point_type {
45
45
impl ToSql for ewkb:: $ptype {
46
46
to_sql_checked!( ) ;
47
47
accepts_geography!( ) ;
48
- fn to_sql( & self , _: & Type , out: & mut Vec <u8 >, _ctx : & SessionInfo ) -> Result <IsNull , Box <Error + Sync + Send >> {
48
+ fn to_sql( & self , _: & Type , out: & mut Vec <u8 >) -> Result <IsNull , Box <Error + Sync + Send >> {
49
49
self . as_ewkb( ) . write_ewkb( out) ?;
50
50
Ok ( IsNull :: No )
51
51
}
@@ -65,7 +65,7 @@ macro_rules! impl_sql_for_geom_type {
65
65
where T : ' a + Point + EwkbRead
66
66
{
67
67
accepts_geography!( ) ;
68
- fn from_sql( ty: & Type , raw: & [ u8 ] , _ctx : & SessionInfo ) -> Result <Self , Box <Error + Sync + Send >> {
68
+ fn from_sql( ty: & Type , raw: & [ u8 ] ) -> Result <Self , Box <Error + Sync + Send >> {
69
69
let mut rdr = Cursor :: new( raw) ;
70
70
ewkb:: $geotype:: <T >:: read_ewkb( & mut rdr) . map_err( |_| format!( "cannot convert {} to {}" , ty, stringify!( $geotype) ) . into( ) )
71
71
}
@@ -76,7 +76,7 @@ macro_rules! impl_sql_for_geom_type {
76
76
{
77
77
to_sql_checked!( ) ;
78
78
accepts_geography!( ) ;
79
- fn to_sql( & self , _: & Type , out: & mut Vec <u8 >, _ctx : & SessionInfo ) -> Result <IsNull , Box <Error + Sync + Send >> {
79
+ fn to_sql( & self , _: & Type , out: & mut Vec <u8 >) -> Result <IsNull , Box <Error + Sync + Send >> {
80
80
self . as_ewkb( ) . write_ewkb( out) ?;
81
81
Ok ( IsNull :: No )
82
82
}
@@ -99,7 +99,7 @@ macro_rules! impl_sql_for_ewkb_type {
99
99
{
100
100
to_sql_checked!( ) ;
101
101
accepts_geography!( ) ;
102
- fn to_sql( & self , _: & Type , out: & mut Vec <u8 >, _ctx : & SessionInfo ) -> Result <IsNull , Box <Error + Sync + Send >> {
102
+ fn to_sql( & self , _: & Type , out: & mut Vec <u8 >) -> Result <IsNull , Box <Error + Sync + Send >> {
103
103
self . write_ewkb( out) ?;
104
104
Ok ( IsNull :: No )
105
105
}
@@ -114,7 +114,7 @@ macro_rules! impl_sql_for_ewkb_type {
114
114
{
115
115
to_sql_checked!( ) ;
116
116
accepts_geography!( ) ;
117
- fn to_sql( & self , _: & Type , out: & mut Vec <u8 >, _ctx : & SessionInfo ) -> Result <IsNull , Box <Error + Sync + Send >> {
117
+ fn to_sql( & self , _: & Type , out: & mut Vec <u8 >) -> Result <IsNull , Box <Error + Sync + Send >> {
118
118
self . write_ewkb( out) ?;
119
119
Ok ( IsNull :: No )
120
120
}
@@ -131,7 +131,7 @@ macro_rules! impl_sql_for_ewkb_type {
131
131
{
132
132
to_sql_checked!( ) ;
133
133
accepts_geography!( ) ;
134
- fn to_sql( & self , _: & Type , out: & mut Vec <u8 >, _ctx : & SessionInfo ) -> Result <IsNull , Box <Error + Sync + Send >> {
134
+ fn to_sql( & self , _: & Type , out: & mut Vec <u8 >) -> Result <IsNull , Box <Error + Sync + Send >> {
135
135
self . write_ewkb( out) ?;
136
136
Ok ( IsNull :: No )
137
137
}
@@ -150,7 +150,7 @@ impl<P> FromSql for ewkb::GeometryT<P>
150
150
where P : Point + EwkbRead
151
151
{
152
152
accepts_geography ! ( ) ;
153
- fn from_sql ( ty : & Type , raw : & [ u8 ] , _ctx : & SessionInfo ) -> Result < Self , Box < Error + Sync + Send > > {
153
+ fn from_sql ( ty : & Type , raw : & [ u8 ] ) -> Result < Self , Box < Error + Sync + Send > > {
154
154
let mut rdr = Cursor :: new ( raw) ;
155
155
ewkb:: GeometryT :: < P > :: read_ewkb ( & mut rdr) . map_err ( |_| format ! ( "cannot convert {} to {}" , ty, stringify!( P ) ) . into ( ) )
156
156
}
@@ -160,7 +160,7 @@ impl<P> FromSql for ewkb::GeometryCollectionT<P>
160
160
where P : Point + EwkbRead
161
161
{
162
162
accepts_geography ! ( ) ;
163
- fn from_sql ( ty : & Type , raw : & [ u8 ] , _ctx : & SessionInfo ) -> Result < Self , Box < Error + Sync + Send > > {
163
+ fn from_sql ( ty : & Type , raw : & [ u8 ] ) -> Result < Self , Box < Error + Sync + Send > > {
164
164
let mut rdr = Cursor :: new ( raw) ;
165
165
ewkb:: GeometryCollectionT :: < P > :: read_ewkb ( & mut rdr) . map_err ( |_| format ! ( "cannot convert {} to {}" , ty, stringify!( P ) ) . into ( ) )
166
166
}
@@ -183,47 +183,47 @@ macro_rules! accepts_bytea {
183
183
184
184
impl FromSql for twkb:: Point {
185
185
accepts_bytea ! ( ) ;
186
- fn from_sql ( ty : & Type , raw : & [ u8 ] , _ctx : & SessionInfo ) -> Result < Self , Box < Error + Sync + Send > > {
186
+ fn from_sql ( ty : & Type , raw : & [ u8 ] ) -> Result < Self , Box < Error + Sync + Send > > {
187
187
let mut rdr = Cursor :: new ( raw) ;
188
188
twkb:: Point :: read_twkb ( & mut rdr) . map_err ( |_| format ! ( "cannot convert {} to Point" , ty) . into ( ) )
189
189
}
190
190
}
191
191
192
192
impl FromSql for twkb:: LineString {
193
193
accepts_bytea ! ( ) ;
194
- fn from_sql ( ty : & Type , raw : & [ u8 ] , _ctx : & SessionInfo ) -> Result < Self , Box < Error + Sync + Send > > {
194
+ fn from_sql ( ty : & Type , raw : & [ u8 ] ) -> Result < Self , Box < Error + Sync + Send > > {
195
195
let mut rdr = Cursor :: new ( raw) ;
196
196
twkb:: LineString :: read_twkb ( & mut rdr) . map_err ( |_| format ! ( "cannot convert {} to LineString" , ty) . into ( ) )
197
197
}
198
198
}
199
199
200
200
impl FromSql for twkb:: Polygon {
201
201
accepts_bytea ! ( ) ;
202
- fn from_sql ( ty : & Type , raw : & [ u8 ] , _ctx : & SessionInfo ) -> Result < Self , Box < Error + Sync + Send > > {
202
+ fn from_sql ( ty : & Type , raw : & [ u8 ] ) -> Result < Self , Box < Error + Sync + Send > > {
203
203
let mut rdr = Cursor :: new ( raw) ;
204
204
twkb:: Polygon :: read_twkb ( & mut rdr) . map_err ( |_| format ! ( "cannot convert {} to Polygon" , ty) . into ( ) )
205
205
}
206
206
}
207
207
208
208
impl FromSql for twkb:: MultiPoint {
209
209
accepts_bytea ! ( ) ;
210
- fn from_sql ( ty : & Type , raw : & [ u8 ] , _ctx : & SessionInfo ) -> Result < Self , Box < Error + Sync + Send > > {
210
+ fn from_sql ( ty : & Type , raw : & [ u8 ] ) -> Result < Self , Box < Error + Sync + Send > > {
211
211
let mut rdr = Cursor :: new ( raw) ;
212
212
twkb:: MultiPoint :: read_twkb ( & mut rdr) . map_err ( |_| format ! ( "cannot convert {} to MultiPoint" , ty) . into ( ) )
213
213
}
214
214
}
215
215
216
216
impl FromSql for twkb:: MultiLineString {
217
217
accepts_bytea ! ( ) ;
218
- fn from_sql ( ty : & Type , raw : & [ u8 ] , _ctx : & SessionInfo ) -> Result < Self , Box < Error + Sync + Send > > {
218
+ fn from_sql ( ty : & Type , raw : & [ u8 ] ) -> Result < Self , Box < Error + Sync + Send > > {
219
219
let mut rdr = Cursor :: new ( raw) ;
220
220
twkb:: MultiLineString :: read_twkb ( & mut rdr) . map_err ( |_| format ! ( "cannot convert {} to MultiLineString" , ty) . into ( ) )
221
221
}
222
222
}
223
223
224
224
impl FromSql for twkb:: MultiPolygon {
225
225
accepts_bytea ! ( ) ;
226
- fn from_sql ( ty : & Type , raw : & [ u8 ] , _ctx : & SessionInfo ) -> Result < Self , Box < Error + Sync + Send > > {
226
+ fn from_sql ( ty : & Type , raw : & [ u8 ] ) -> Result < Self , Box < Error + Sync + Send > > {
227
227
let mut rdr = Cursor :: new ( raw) ;
228
228
twkb:: MultiPolygon :: read_twkb ( & mut rdr) . map_err ( |_| format ! ( "cannot convert {} to MultiPolygon" , ty) . into ( ) )
229
229
}
0 commit comments