Skip to content

Commit c77d29c

Browse files
yannleretailleandelf
authored andcommitted
update to postgres 0.14 (#10)
* update to postgres 0.13 * make compatible with postgres-0.14: SessionInfo was removed * version bump
1 parent fdfbb9c commit c77d29c

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "postgis"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
authors = ["ShuYu Wang <andelf@gmail.com>", "Pirmin Kalberer <pka@sourcepole.ch>"]
55
description = "An extension to rust-postgres, adds support for PostGIS."
66
homepage = "https://github.com/andelf/rust-postgis"
@@ -14,5 +14,5 @@ license = "MIT"
1414
doctest = false
1515

1616
[dependencies]
17-
postgres = "^0.13"
17+
postgres = "^0.14"
1818
byteorder = "^0.5"

src/postgis.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use types::{Point, LineString, Polygon};
66
use ewkb::{self, EwkbRead, EwkbWrite, AsEwkbPoint, AsEwkbLineString, AsEwkbPolygon, AsEwkbMultiPoint, AsEwkbMultiLineString, AsEwkbMultiPolygon};
77
use twkb::{self, TwkbGeom};
88
use std::io::Cursor;
9-
use postgres::types::{Type, IsNull, ToSql, FromSql, SessionInfo};
9+
use postgres::types::{Type, IsNull, ToSql, FromSql};
1010
use std::error::Error;
1111

1212

@@ -26,7 +26,7 @@ macro_rules! accepts_geography {
2626
impl<'a> ToSql for ewkb::EwkbPoint<'a> {
2727
to_sql_checked!();
2828
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>> {
3030
self.write_ewkb(out)?;
3131
Ok(IsNull::No)
3232
}
@@ -36,7 +36,7 @@ macro_rules! impl_sql_for_point_type {
3636
($ptype:ident) => (
3737
impl FromSql for ewkb::$ptype {
3838
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>> {
4040
let mut rdr = Cursor::new(raw);
4141
ewkb::$ptype::read_ewkb(&mut rdr).map_err(|_| format!("cannot convert {} to {}", ty, stringify!($ptype)).into())
4242
}
@@ -45,7 +45,7 @@ macro_rules! impl_sql_for_point_type {
4545
impl ToSql for ewkb::$ptype {
4646
to_sql_checked!();
4747
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>> {
4949
self.as_ewkb().write_ewkb(out)?;
5050
Ok(IsNull::No)
5151
}
@@ -65,7 +65,7 @@ macro_rules! impl_sql_for_geom_type {
6565
where T: 'a + Point + EwkbRead
6666
{
6767
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>> {
6969
let mut rdr = Cursor::new(raw);
7070
ewkb::$geotype::<T>::read_ewkb(&mut rdr).map_err(|_| format!("cannot convert {} to {}", ty, stringify!($geotype)).into())
7171
}
@@ -76,7 +76,7 @@ macro_rules! impl_sql_for_geom_type {
7676
{
7777
to_sql_checked!();
7878
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>> {
8080
self.as_ewkb().write_ewkb(out)?;
8181
Ok(IsNull::No)
8282
}
@@ -99,7 +99,7 @@ macro_rules! impl_sql_for_ewkb_type {
9999
{
100100
to_sql_checked!();
101101
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>> {
103103
self.write_ewkb(out)?;
104104
Ok(IsNull::No)
105105
}
@@ -114,7 +114,7 @@ macro_rules! impl_sql_for_ewkb_type {
114114
{
115115
to_sql_checked!();
116116
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>> {
118118
self.write_ewkb(out)?;
119119
Ok(IsNull::No)
120120
}
@@ -131,7 +131,7 @@ macro_rules! impl_sql_for_ewkb_type {
131131
{
132132
to_sql_checked!();
133133
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>> {
135135
self.write_ewkb(out)?;
136136
Ok(IsNull::No)
137137
}
@@ -150,7 +150,7 @@ impl<P> FromSql for ewkb::GeometryT<P>
150150
where P: Point + EwkbRead
151151
{
152152
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>> {
154154
let mut rdr = Cursor::new(raw);
155155
ewkb::GeometryT::<P>::read_ewkb(&mut rdr).map_err(|_| format!("cannot convert {} to {}", ty, stringify!(P)).into())
156156
}
@@ -160,7 +160,7 @@ impl<P> FromSql for ewkb::GeometryCollectionT<P>
160160
where P: Point + EwkbRead
161161
{
162162
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>> {
164164
let mut rdr = Cursor::new(raw);
165165
ewkb::GeometryCollectionT::<P>::read_ewkb(&mut rdr).map_err(|_| format!("cannot convert {} to {}", ty, stringify!(P)).into())
166166
}
@@ -183,47 +183,47 @@ macro_rules! accepts_bytea {
183183

184184
impl FromSql for twkb::Point {
185185
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>> {
187187
let mut rdr = Cursor::new(raw);
188188
twkb::Point::read_twkb(&mut rdr).map_err(|_| format!("cannot convert {} to Point", ty).into())
189189
}
190190
}
191191

192192
impl FromSql for twkb::LineString {
193193
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>> {
195195
let mut rdr = Cursor::new(raw);
196196
twkb::LineString::read_twkb(&mut rdr).map_err(|_| format!("cannot convert {} to LineString", ty).into())
197197
}
198198
}
199199

200200
impl FromSql for twkb::Polygon {
201201
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>> {
203203
let mut rdr = Cursor::new(raw);
204204
twkb::Polygon::read_twkb(&mut rdr).map_err(|_| format!("cannot convert {} to Polygon", ty).into())
205205
}
206206
}
207207

208208
impl FromSql for twkb::MultiPoint {
209209
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>> {
211211
let mut rdr = Cursor::new(raw);
212212
twkb::MultiPoint::read_twkb(&mut rdr).map_err(|_| format!("cannot convert {} to MultiPoint", ty).into())
213213
}
214214
}
215215

216216
impl FromSql for twkb::MultiLineString {
217217
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>> {
219219
let mut rdr = Cursor::new(raw);
220220
twkb::MultiLineString::read_twkb(&mut rdr).map_err(|_| format!("cannot convert {} to MultiLineString", ty).into())
221221
}
222222
}
223223

224224
impl FromSql for twkb::MultiPolygon {
225225
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>> {
227227
let mut rdr = Cursor::new(raw);
228228
twkb::MultiPolygon::read_twkb(&mut rdr).map_err(|_| format!("cannot convert {} to MultiPolygon", ty).into())
229229
}

0 commit comments

Comments
 (0)