| 1 | use bytesrust-analyzer cargo bytes 1.11.1 crate/::BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#; |
| 2 | use fallible_iteratorrust-analyzer cargo fallible-iterator 0.3.0 crate/::FallibleIteratorrust-analyzer cargo fallible-iterator 0.3.0 FallibleIterator#; |
| 3 | use geo_types_0_7rust-analyzer cargo geo-types 0.7.19 crate/::{Coordrust-analyzer cargo geo-types 0.7.19 geometry/coord/Coord#, LineStringrust-analyzer cargo geo-types 0.7.19 geometry/line_string/LineString#, Pointrust-analyzer cargo geo-types 0.7.19 geometry/point/Point#, Rectrust-analyzer cargo geo-types 0.7.19 geometry/rect/Rect#}; |
| 4 | use postgres_protocolrust-analyzer cargo postgres-protocol 0.6.12 crate/::typesrust-analyzer cargo postgres-protocol 0.6.12 types/; |
| 5 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#; |
| 6 | |
| 7 | use craterust-analyzer cargo postgres-types 0.2.14 crate/::{FromSqlrust-analyzer cargo postgres-types 0.2.14 FromSql#, IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#, ToSqlrust-analyzer cargo postgres-types 0.2.14 ToSql#, Typerust-analyzer cargo postgres-types 0.2.14 Type#}; |
| 8 | |
| 9 | impl<'a> FromSqlrust-analyzer cargo postgres-types 0.2.14 FromSql#<'a> for Pointrust-analyzer cargo geo-types 0.7.19 geometry/point/Point#<f64> { |
| 10 | fn from_sqlrust-analyzer cargo postgres-types 0.2.14 geo_types_07/impl#[Point][`FromSql<'a>`]from_sql().(_: &Typerust-analyzer cargo postgres-types 0.2.14 Type#, raw: &[u8]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo postgres-types 0.2.14 geo_types_07/impl#[Point][`FromSql<'a>`], Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> { |
| 11 | let point = typesrust-analyzer cargo postgres-protocol 0.6.12 types/::point_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/point_from_sql().(raw)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 12 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Pointrust-analyzer cargo geo-types 0.7.19 geometry/point/Point#::newrust-analyzer cargo geo-types 0.7.19 geometry/point/impl#[`Point<T>`]new().(point.xrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[Point]x().(), point.yrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[Point]y().())) |
| 13 | } |
| 14 | |
| 15 | acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(POINTrust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]POINT.); |
| 16 | } |
| 17 | |
| 18 | impl ToSqlrust-analyzer cargo postgres-types 0.2.14 ToSql# for Pointrust-analyzer cargo geo-types 0.7.19 geometry/point/Point#<f64> { |
| 19 | fn to_sqlrust-analyzer cargo postgres-types 0.2.14 geo_types_07/impl#[Point][ToSql]to_sql().(&self, _: &Typerust-analyzer cargo postgres-types 0.2.14 Type#, out: &mut BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> { |
| 20 | typesrust-analyzer cargo postgres-protocol 0.6.12 types/::point_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/point_to_sql().(self.xrust-analyzer cargo geo-types 0.7.19 geometry/point/impl#[`Point<T>`]x().(), self.yrust-analyzer cargo geo-types 0.7.19 geometry/point/impl#[`Point<T>`]y().(), out); |
| 21 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#::Norust-analyzer cargo postgres-types 0.2.14 IsNull#No#) |
| 22 | } |
| 23 | |
| 24 | acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(POINTrust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]POINT.); |
| 25 | to_sql_checkedrust-analyzer cargo postgres-types 0.2.14 to_sql_checked!!(); |
| 26 | } |
| 27 | |
| 28 | impl<'a> FromSqlrust-analyzer cargo postgres-types 0.2.14 FromSql#<'a> for Rectrust-analyzer cargo geo-types 0.7.19 geometry/rect/Rect#<f64> { |
| 29 | fn from_sqlrust-analyzer cargo postgres-types 0.2.14 geo_types_07/impl#[Rect][`FromSql<'a>`]from_sql().(_: &Typerust-analyzer cargo postgres-types 0.2.14 Type#, raw: &[u8]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo postgres-types 0.2.14 geo_types_07/impl#[Rect][`FromSql<'a>`], Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> { |
| 30 | let rect = typesrust-analyzer cargo postgres-protocol 0.6.12 types/::box_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/box_from_sql().(raw)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 31 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Rectrust-analyzer cargo geo-types 0.7.19 geometry/rect/Rect#::newrust-analyzer cargo geo-types 0.7.19 geometry/rect/impl#[`Rect<T>`]new().( |
| 32 | (rect.lower_leftrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[Box]lower_left().().xrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[Point]x().(), rect.lower_leftrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[Box]lower_left().().yrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[Point]y().()), |
| 33 | (rect.upper_rightrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[Box]upper_right().().xrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[Point]x().(), rect.upper_rightrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[Box]upper_right().().yrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[Point]y().()), |
| 34 | )) |
| 35 | } |
| 36 | |
| 37 | acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(BOXrust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]BOX.); |
| 38 | } |
| 39 | |
| 40 | impl ToSqlrust-analyzer cargo postgres-types 0.2.14 ToSql# for Rectrust-analyzer cargo geo-types 0.7.19 geometry/rect/Rect#<f64> { |
| 41 | fn to_sqlrust-analyzer cargo postgres-types 0.2.14 geo_types_07/impl#[Rect][ToSql]to_sql().(&self, _: &Typerust-analyzer cargo postgres-types 0.2.14 Type#, out: &mut BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> { |
| 42 | typesrust-analyzer cargo postgres-protocol 0.6.12 types/::box_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/box_to_sql().(self.minrust-analyzer cargo geo-types 0.7.19 geometry/rect/impl#[`Rect<T>`]min().().xrust-analyzer cargo geo-types 0.7.19 geometry/coord/Coord#x., self.minrust-analyzer cargo geo-types 0.7.19 geometry/rect/impl#[`Rect<T>`]min().().yrust-analyzer cargo geo-types 0.7.19 geometry/coord/Coord#y., self.maxrust-analyzer cargo geo-types 0.7.19 geometry/rect/impl#[`Rect<T>`]max().().xrust-analyzer cargo geo-types 0.7.19 geometry/coord/Coord#x., self.maxrust-analyzer cargo geo-types 0.7.19 geometry/rect/impl#[`Rect<T>`]max().().yrust-analyzer cargo geo-types 0.7.19 geometry/coord/Coord#y., out); |
| 43 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#::Norust-analyzer cargo postgres-types 0.2.14 IsNull#No#) |
| 44 | } |
| 45 | |
| 46 | acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(BOXrust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]BOX.); |
| 47 | to_sql_checkedrust-analyzer cargo postgres-types 0.2.14 to_sql_checked!!(); |
| 48 | } |
| 49 | |
| 50 | impl<'a> FromSqlrust-analyzer cargo postgres-types 0.2.14 FromSql#<'a> for LineStringrust-analyzer cargo geo-types 0.7.19 geometry/line_string/LineString#<f64> { |
| 51 | fn from_sqlrust-analyzer cargo postgres-types 0.2.14 geo_types_07/impl#[LineString][`FromSql<'a>`]from_sql().(_: &Typerust-analyzer cargo postgres-types 0.2.14 Type#, raw: &[u8]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo postgres-types 0.2.14 geo_types_07/impl#[LineString][`FromSql<'a>`], Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> { |
| 52 | let path = typesrust-analyzer cargo postgres-protocol 0.6.12 types/::path_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/path_from_sql().(raw)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 53 | let points = path |
| 54 | .pointsrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[`Path<'a>`]points().() |
| 55 | .map(|p| Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Coordrust-analyzer cargo geo-types 0.7.19 geometry/coord/Coord# { xrust-analyzer cargo geo-types 0.7.19 geometry/coord/Coord#x.: p.x(), yrust-analyzer cargo geo-types 0.7.19 geometry/coord/Coord#y.: p.y() })) |
| 56 | .collect()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/try_trait/Try#branch().; |
| 57 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(LineStringrust-analyzer cargo geo-types 0.7.19 geometry/line_string/LineString#(points)) |
| 58 | } |
| 59 | |
| 60 | acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(PATHrust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]PATH.); |
| 61 | } |
| 62 | |
| 63 | impl ToSqlrust-analyzer cargo postgres-types 0.2.14 ToSql# for LineStringrust-analyzer cargo geo-types 0.7.19 geometry/line_string/LineString#<f64> { |
| 64 | fn to_sqlrust-analyzer cargo postgres-types 0.2.14 geo_types_07/impl#[LineString][ToSql]to_sql().(&self, _: &Typerust-analyzer cargo postgres-types 0.2.14 Type#, out: &mut BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> { |
| 65 | let closed = false; // always encode an open path from LineString |
| 66 | typesrust-analyzer cargo postgres-protocol 0.6.12 types/::path_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/path_to_sql().(closed, self.0rust-analyzer cargo geo-types 0.7.19 geometry/line_string/LineString#0..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|p| (p.xrust-analyzer cargo geo-types 0.7.19 geometry/coord/Coord#x., p.yrust-analyzer cargo geo-types 0.7.19 geometry/coord/Coord#y.)), out)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 67 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#::Norust-analyzer cargo postgres-types 0.2.14 IsNull#No#) |
| 68 | } |
| 69 | |
| 70 | acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(PATHrust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]PATH.); |
| 71 | to_sql_checkedrust-analyzer cargo postgres-types 0.2.14 to_sql_checked!!(); |
| 72 | } |