| 1 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::decoderust-analyzer cargo sqlx-core 0.8.3 decode/::Decoderust-analyzer cargo sqlx-core 0.8.3 decode/Decode#; |
| 2 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::encoderust-analyzer cargo sqlx-core 0.8.3 encode/::{Encoderust-analyzer cargo sqlx-core 0.8.3 encode/Encode#, IsNullrust-analyzer cargo sqlx-core 0.8.3 encode/IsNull#}; |
| 3 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::errorrust-analyzer cargo sqlx-postgres 0.8.3 error/::BoxDynErrorrust-analyzer cargo sqlx-core 0.8.3 error/BoxDynError#; |
| 4 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::typesrust-analyzer cargo sqlx-postgres 0.8.3 types/::Typerust-analyzer cargo sqlx-core 0.8.3 types/Type#; |
| 5 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::{PgArgumentBufferrust-analyzer cargo sqlx-postgres 0.8.3 arguments/PgArgumentBuffer#, PgHasArrayTyperust-analyzer cargo sqlx-postgres 0.8.3 types/array/PgHasArrayType#, PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#, PgValueFormatrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#, PgValueRefrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueRef#, Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#}; |
| 6 | use sqlx_corerust-analyzer cargo sqlx-core 0.8.3 crate/::bytesrust-analyzer cargo bytes 1.12.1 crate/::Bufrust-analyzer cargo bytes 1.12.1 buf/buf_impl/Buf#; |
| 7 | use sqlx_corerust-analyzer cargo sqlx-core 0.8.3 crate/::Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#; |
| 8 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#; |
| 9 | |
| 10 | /// ## Postgres Geometric Point type |
| 11 | /// |
| 12 | /// Description: Point on a plane |
| 13 | /// Representation: `(x, y)` |
| 14 | /// |
| 15 | /// Points are the fundamental two-dimensional building block for geometric types. Values of type point are specified using either of the following syntaxes: |
| 16 | /// ```text |
| 17 | /// ( x , y ) |
| 18 | /// x , y |
| 19 | /// ```` |
| 20 | /// where x and y are the respective coordinates, as floating-point numbers. |
| 21 | /// |
| 22 | /// See https://www.postgresql.org/docs/16/datatype-geometric.html#DATATYPE-GEOMETRIC-POINTS |
| 23 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 24 | pub struct PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint# { |
| 25 | pub xrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#x.: f64, |
| 26 | pub yrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#y.: f64, |
| 27 | } |
| 28 | |
| 29 | impl Typerust-analyzer cargo sqlx-core 0.8.3 types/Type#<Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#> for PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint# { |
| 30 | fn type_inforust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint][`Type<Postgres>`]type_info().() -> PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo# { |
| 31 | PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#::with_namerust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo]with_name().("point") |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | impl PgHasArrayTyperust-analyzer cargo sqlx-postgres 0.8.3 types/array/PgHasArrayType# for PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint# { |
| 36 | fn array_type_inforust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint][PgHasArrayType]array_type_info().() -> PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo# { |
| 37 | PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#::with_namerust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo]with_name().("_point") |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | impl<'r> Decoderust-analyzer cargo sqlx-core 0.8.3 decode/Decode#<'r, Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#> for PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint# { |
| 42 | fn decoderust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint][`Decode<'r, Postgres>`]decode().(value: PgValueRefrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueRef#<'r>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint][`Decode<'r, Postgres>`], Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn 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# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#>> { |
| 43 | match value.formatrust-analyzer cargo sqlx-postgres 0.8.3 value/impl#[`PgValueRef<'r>`]format().() { |
| 44 | PgValueFormatrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#::Textrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#Text# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#::from_strrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint][FromStr]from_str().(value.as_strrust-analyzer cargo sqlx-postgres 0.8.3 value/impl#[`PgValueRef<'r>`]as_str().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().), |
| 45 | PgValueFormatrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#::Binaryrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#Binary# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#::from_bytesrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint]from_bytes().(value.as_bytesrust-analyzer cargo sqlx-postgres 0.8.3 value/impl#[`PgValueRef<'r>`]as_bytes().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().), |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | impl<'q> Encoderust-analyzer cargo sqlx-core 0.8.3 encode/Encode#<'q, Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#> for PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint# { |
| 51 | fn producesrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint][`Encode<'q, Postgres>`]produces().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#> { |
| 52 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#::with_namerust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo]with_name().("point")) |
| 53 | } |
| 54 | |
| 55 | fn encode_by_refrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint][`Encode<'q, Postgres>`]encode_by_ref().(&self, buf: &mut PgArgumentBufferrust-analyzer cargo sqlx-postgres 0.8.3 arguments/PgArgumentBuffer#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<IsNullrust-analyzer cargo sqlx-core 0.8.3 encode/IsNull#, BoxDynErrorrust-analyzer cargo sqlx-core 0.8.3 error/BoxDynError#> { |
| 56 | self.serializerust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint]serialize().(buf)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 57 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IsNullrust-analyzer cargo sqlx-core 0.8.3 encode/IsNull#::Norust-analyzer cargo sqlx-core 0.8.3 encode/IsNull#No#) |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | fn parse_float_from_strrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/parse_float_from_str().(s: &str, error_msg: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<f64, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 62 | s.trimrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim().() |
| 63 | .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().() |
| 64 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#::Decoderust-analyzer cargo sqlx-core 0.8.3 error/Error#Decode#(error_msg.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 65 | } |
| 66 | |
| 67 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint# { |
| 68 | type Errrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint][FromStr]Err# = BoxDynErrorrust-analyzer cargo sqlx-core 0.8.3 error/BoxDynError#; |
| 69 | |
| 70 | fn from_strrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint][FromStr]from_str().(s: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint][FromStr], Selfrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint][FromStr]::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#> { |
| 71 | let (x_str, y_str) = s |
| 72 | .trim_matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_matches().(|c| c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'(' || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().')' || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().' ') |
| 73 | .split_oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_once().(',') |
| 74 | .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("error decoding POINT: could not get x and y from {}", s))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 75 | |
| 76 | let x = parse_float_from_strrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/parse_float_from_str().(x_str, "error decoding POINT: could not get x")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 77 | let y = parse_float_from_strrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/parse_float_from_str().(y_str, "error decoding POINT: could not get x")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 78 | |
| 79 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint# { xrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#x., yrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#y. }) |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | impl PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint# { |
| 84 | fn from_bytesrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint]from_bytes().(mut bytes: &[u8]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#, BoxDynErrorrust-analyzer cargo sqlx-core 0.8.3 error/BoxDynError#> { |
| 85 | let x = bytes.get_f64rust-analyzer cargo bytes 1.12.1 buf/buf_impl/Buf#get_f64().(); |
| 86 | let y = bytes.get_f64rust-analyzer cargo bytes 1.12.1 buf/buf_impl/Buf#get_f64().(); |
| 87 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint# { xrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#x., yrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#y. }) |
| 88 | } |
| 89 | |
| 90 | fn serializerust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint]serialize().(&self, buff: &mut PgArgumentBufferrust-analyzer cargo sqlx-postgres 0.8.3 arguments/PgArgumentBuffer#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), BoxDynErrorrust-analyzer cargo sqlx-core 0.8.3 error/BoxDynError#> { |
| 91 | buff.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(&self.xrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#x..to_be_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]to_be_bytes().()); |
| 92 | buff.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(&self.yrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#y..to_be_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]to_be_bytes().()); |
| 93 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 94 | } |
| 95 | |
| 96 | #[cfg(test)] |
| 97 | fn serialize_to_vecrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint]serialize_to_vec().(&self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> { |
| 98 | let mut buff = PgArgumentBufferrust-analyzer cargo sqlx-postgres 0.8.3 arguments/PgArgumentBuffer#::defaultrust-analyzer cargo sqlx-postgres 0.8.3 arguments/impl#[PgArgumentBuffer][Default]default().(); |
| 99 | self.serializerust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint]serialize().(&mut buff).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 100 | buff.to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().() |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | #[cfg(test)] |
| 105 | mod point_testsrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/point_tests/ { |
| 106 | |
| 107 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#; |
| 108 | |
| 109 | use superrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/::PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#; |
| 110 | |
| 111 | const POINT_BYTESrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/point_tests/POINT_BYTES.: &[u8] = &[ |
| 112 | 64, 0, 204, 204, 204, 204, 204, 205, 64, 20, 204, 204, 204, 204, 204, 205, |
| 113 | ]; |
| 114 | |
| 115 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 116 | fn can_deserialise_point_type_bytesrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/point_tests/can_deserialise_point_type_bytes().() { |
| 117 | let point = PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#::from_bytesrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint]from_bytes().(POINT_BYTESrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/point_tests/POINT_BYTES.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 118 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(point, PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint# { xrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#x.: 2.1, yrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#y.: 5.2 }) |
| 119 | } |
| 120 | |
| 121 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 122 | fn can_deserialise_point_type_strrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/point_tests/can_deserialise_point_type_str().() { |
| 123 | let point = PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#::from_strrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint][FromStr]from_str().("(2, 3)").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 124 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(point, PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint# { xrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#x.: 2., yrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#y.: 3. }); |
| 125 | } |
| 126 | |
| 127 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 128 | fn can_deserialise_point_type_str_floatrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/point_tests/can_deserialise_point_type_str_float().() { |
| 129 | let point = PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#::from_strrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint][FromStr]from_str().("(2.5, 3.4)").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 130 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(point, PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint# { xrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#x.: 2.5, yrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#y.: 3.4 }); |
| 131 | } |
| 132 | |
| 133 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 134 | fn can_serialise_point_typerust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/point_tests/can_serialise_point_type().() { |
| 135 | let point = PgPointrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint# { xrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#x.: 2.1, yrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/PgPoint#y.: 5.2 }; |
| 136 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(point.serialize_to_vecrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/impl#[PgPoint]serialize_to_vec().(), POINT_BYTESrust-analyzer cargo sqlx-postgres 0.8.3 types/geometry/point/point_tests/POINT_BYTES.,) |
| 137 | } |
| 138 | } |