| 1 | use bytesrust-analyzer cargo bytes 1.11.1 crate/::{Bufrust-analyzer cargo bytes 1.11.1 buf/buf_impl/Buf#, 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 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#; |
| 4 | |
| 5 | use superrust-analyzer cargo postgres-protocol 0.6.12 types/::*; |
| 6 | use craterust-analyzer cargo postgres-protocol 0.6.12 crate/::IsNullrust-analyzer cargo postgres-protocol 0.6.12 IsNull#; |
| 7 | |
| 8 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 9 | #[allow(clippy::bool_assert_comparison)] |
| 10 | fn boolrust-analyzer cargo postgres-protocol 0.6.12 types/test/bool().() { |
| 11 | let mut buf = BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#::newrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]new().(); |
| 12 | bool_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/bool_to_sql().(true, &mut buf); |
| 13 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bool_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/bool_from_sql().(&buf).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), true); |
| 14 | |
| 15 | let mut buf = BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#::newrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]new().(); |
| 16 | bool_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/bool_to_sql().(false, &mut buf); |
| 17 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bool_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/bool_from_sql().(&buf).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), false); |
| 18 | } |
| 19 | |
| 20 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 21 | fn int2rust-analyzer cargo postgres-protocol 0.6.12 types/test/int2().() { |
| 22 | let mut buf = BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#::newrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]new().(); |
| 23 | int2_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/int2_to_sql().(0x0102, &mut buf); |
| 24 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(int2_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/int2_from_sql().(&buf).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 0x0102); |
| 25 | } |
| 26 | |
| 27 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 28 | fn int4rust-analyzer cargo postgres-protocol 0.6.12 types/test/int4().() { |
| 29 | let mut buf = BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#::newrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]new().(); |
| 30 | int4_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/int4_to_sql().(0x0102_0304, &mut buf); |
| 31 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(int4_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/int4_from_sql().(&buf).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 0x0102_0304); |
| 32 | } |
| 33 | |
| 34 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 35 | fn int8rust-analyzer cargo postgres-protocol 0.6.12 types/test/int8().() { |
| 36 | let mut buf = BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#::newrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]new().(); |
| 37 | int8_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/int8_to_sql().(0x0102_0304_0506_0708, &mut buf); |
| 38 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(int8_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/int8_from_sql().(&buf).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 0x0102_0304_0506_0708); |
| 39 | } |
| 40 | |
| 41 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 42 | #[allow(clippy::float_cmp)] |
| 43 | fn float4rust-analyzer cargo postgres-protocol 0.6.12 types/test/float4().() { |
| 44 | let mut buf = BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#::newrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]new().(); |
| 45 | float4_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/float4_to_sql().(10343.95, &mut buf); |
| 46 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(float4_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/float4_from_sql().(&buf).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 10343.95); |
| 47 | } |
| 48 | |
| 49 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 50 | #[allow(clippy::float_cmp)] |
| 51 | fn float8rust-analyzer cargo postgres-protocol 0.6.12 types/test/float8().() { |
| 52 | let mut buf = BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#::newrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]new().(); |
| 53 | float8_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/float8_to_sql().(10343.95, &mut buf); |
| 54 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(float8_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/float8_from_sql().(&buf).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 10343.95); |
| 55 | } |
| 56 | |
| 57 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 58 | fn hstorerust-analyzer cargo postgres-protocol 0.6.12 types/test/hstore().() { |
| 59 | let mut map = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 60 | map.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("hello", Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("world")); |
| 61 | map.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("hola", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 62 | |
| 63 | let mut buf = BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#::newrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]new().(); |
| 64 | hstore_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/hstore_to_sql().(map.iterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(&k, &v)| (k, v)), &mut buf).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 65 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 66 | hstore_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/hstore_from_sql().(&buf) |
| 67 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 68 | .collectrust-analyzer cargo fallible-iterator 0.3.0 FallibleIterator#collect().::<HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<_, _>>() |
| 69 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 70 | map |
| 71 | ); |
| 72 | } |
| 73 | |
| 74 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 75 | fn hstore_invalid_lengthrust-analyzer cargo postgres-protocol 0.6.12 types/test/hstore_invalid_length().() { |
| 76 | // a malicious server can declare a key (or value) length larger than the |
| 77 | // remaining buffer; this must error rather than panic. |
| 78 | let buf: &[u8] = &[ |
| 79 | 0, 0, 0, 1, // entry count: 1 |
| 80 | 0, 0, 3, 232, // key length: 1000 |
| 81 | b'a', b'b', // only two bytes actually present |
| 82 | ]; |
| 83 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!( |
| 84 | hstore_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/hstore_from_sql().(buf) |
| 85 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 86 | .collectrust-analyzer cargo fallible-iterator 0.3.0 FallibleIterator#collect().::<HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<_, _>>() |
| 87 | .is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().() |
| 88 | ); |
| 89 | } |
| 90 | |
| 91 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 92 | fn varbitrust-analyzer cargo postgres-protocol 0.6.12 types/test/varbit().() { |
| 93 | let len = 12; |
| 94 | let bits = [0b0010_1011, 0b0000_1111]; |
| 95 | |
| 96 | let mut buf = BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#::newrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]new().(); |
| 97 | varbit_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/varbit_to_sql().(len, bits.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().(), &mut buf).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 98 | let out = varbit_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/varbit_from_sql().(&buf).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 99 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(out.lenrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[`Varbit<'a>`]len().(), len); |
| 100 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(out.bytesrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[`Varbit<'a>`]bytes().(), bits); |
| 101 | } |
| 102 | |
| 103 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 104 | fn arrayrust-analyzer cargo postgres-protocol 0.6.12 types/test/array().() { |
| 105 | let dimensions = [ |
| 106 | ArrayDimensionrust-analyzer cargo postgres-protocol 0.6.12 types/ArrayDimension# { |
| 107 | lenrust-analyzer cargo postgres-protocol 0.6.12 types/ArrayDimension#len.: 1, |
| 108 | lower_boundrust-analyzer cargo postgres-protocol 0.6.12 types/ArrayDimension#lower_bound.: 10, |
| 109 | }, |
| 110 | ArrayDimensionrust-analyzer cargo postgres-protocol 0.6.12 types/ArrayDimension# { |
| 111 | lenrust-analyzer cargo postgres-protocol 0.6.12 types/ArrayDimension#len.: 2, |
| 112 | lower_boundrust-analyzer cargo postgres-protocol 0.6.12 types/ArrayDimension#lower_bound.: 0, |
| 113 | }, |
| 114 | ]; |
| 115 | let values = [Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&b"hello"[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().)]; |
| 116 | |
| 117 | let mut buf = BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#::newrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]new().(); |
| 118 | array_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/array_to_sql().( |
| 119 | dimensions.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().(), |
| 120 | 10, |
| 121 | values.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().(), |
| 122 | |v, buf| match v { |
| 123 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(v) => { |
| 124 | buf.extend_from_slicerust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]extend_from_slice().(v); |
| 125 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IsNullrust-analyzer cargo postgres-protocol 0.6.12 IsNull#::Norust-analyzer cargo postgres-protocol 0.6.12 IsNull#No#) |
| 126 | } |
| 127 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IsNullrust-analyzer cargo postgres-protocol 0.6.12 IsNull#::Yesrust-analyzer cargo postgres-protocol 0.6.12 IsNull#Yes#), |
| 128 | }, |
| 129 | &mut buf, |
| 130 | ) |
| 131 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 132 | |
| 133 | let array = array_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/array_from_sql().(&buf).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 134 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(array.has_nullsrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[`Array<'a>`]has_nulls().()); |
| 135 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(array.element_typerust-analyzer cargo postgres-protocol 0.6.12 types/impl#[`Array<'a>`]element_type().(), 10); |
| 136 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(array.dimensionsrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[`Array<'a>`]dimensions().().collectrust-analyzer cargo fallible-iterator 0.3.0 FallibleIterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), dimensions); |
| 137 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(array.valuesrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[`Array<'a>`]values().().collectrust-analyzer cargo fallible-iterator 0.3.0 FallibleIterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), values); |
| 138 | } |
| 139 | |
| 140 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 141 | fn non_null_arrayrust-analyzer cargo postgres-protocol 0.6.12 types/test/non_null_array().() { |
| 142 | let dimensions = [ |
| 143 | ArrayDimensionrust-analyzer cargo postgres-protocol 0.6.12 types/ArrayDimension# { |
| 144 | lenrust-analyzer cargo postgres-protocol 0.6.12 types/ArrayDimension#len.: 1, |
| 145 | lower_boundrust-analyzer cargo postgres-protocol 0.6.12 types/ArrayDimension#lower_bound.: 10, |
| 146 | }, |
| 147 | ArrayDimensionrust-analyzer cargo postgres-protocol 0.6.12 types/ArrayDimension# { |
| 148 | lenrust-analyzer cargo postgres-protocol 0.6.12 types/ArrayDimension#len.: 2, |
| 149 | lower_boundrust-analyzer cargo postgres-protocol 0.6.12 types/ArrayDimension#lower_bound.: 0, |
| 150 | }, |
| 151 | ]; |
| 152 | let values = [Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&b"hola"[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&b"hello"[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().)]; |
| 153 | |
| 154 | let mut buf = BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#::newrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]new().(); |
| 155 | array_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/array_to_sql().( |
| 156 | dimensions.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().(), |
| 157 | 10, |
| 158 | values.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().(), |
| 159 | |v, buf| match v { |
| 160 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(v) => { |
| 161 | buf.extend_from_slicerust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]extend_from_slice().(v); |
| 162 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IsNullrust-analyzer cargo postgres-protocol 0.6.12 IsNull#::Norust-analyzer cargo postgres-protocol 0.6.12 IsNull#No#) |
| 163 | } |
| 164 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IsNullrust-analyzer cargo postgres-protocol 0.6.12 IsNull#::Yesrust-analyzer cargo postgres-protocol 0.6.12 IsNull#Yes#), |
| 165 | }, |
| 166 | &mut buf, |
| 167 | ) |
| 168 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 169 | |
| 170 | let array = array_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/array_from_sql().(&buf).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 171 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().array.has_nullsrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[`Array<'a>`]has_nulls().()); |
| 172 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(array.element_typerust-analyzer cargo postgres-protocol 0.6.12 types/impl#[`Array<'a>`]element_type().(), 10); |
| 173 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(array.dimensionsrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[`Array<'a>`]dimensions().().collectrust-analyzer cargo fallible-iterator 0.3.0 FallibleIterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), dimensions); |
| 174 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(array.valuesrust-analyzer cargo postgres-protocol 0.6.12 types/impl#[`Array<'a>`]values().().collectrust-analyzer cargo fallible-iterator 0.3.0 FallibleIterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), values); |
| 175 | } |
| 176 | |
| 177 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 178 | fn ltree_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/test/ltree_sql().() { |
| 179 | let mut query = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1u8]; |
| 180 | query.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().("A.B.C".as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()); |
| 181 | |
| 182 | let mut buf = BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#::newrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]new().(); |
| 183 | |
| 184 | ltree_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/ltree_to_sql().("A.B.C", &mut buf); |
| 185 | |
| 186 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(query.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().(), buf.chunkrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut][Buf]chunk().()); |
| 187 | } |
| 188 | |
| 189 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 190 | fn ltree_strrust-analyzer cargo postgres-protocol 0.6.12 types/test/ltree_str().() { |
| 191 | let mut query = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1u8]; |
| 192 | query.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().("A.B.C".as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()); |
| 193 | |
| 194 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(ltree_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/ltree_from_sql().(query.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().()).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().()) |
| 195 | } |
| 196 | |
| 197 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 198 | fn ltree_wrong_versionrust-analyzer cargo postgres-protocol 0.6.12 types/test/ltree_wrong_version().() { |
| 199 | let mut query = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![2u8]; |
| 200 | query.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().("A.B.C".as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()); |
| 201 | |
| 202 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(ltree_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/ltree_from_sql().(query.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().()).is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()) |
| 203 | } |
| 204 | |
| 205 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 206 | fn lquery_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/test/lquery_sql().() { |
| 207 | let mut query = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1u8]; |
| 208 | query.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().("A.B.C".as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()); |
| 209 | |
| 210 | let mut buf = BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#::newrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]new().(); |
| 211 | |
| 212 | lquery_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/lquery_to_sql().("A.B.C", &mut buf); |
| 213 | |
| 214 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(query.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().(), buf.chunkrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut][Buf]chunk().()); |
| 215 | } |
| 216 | |
| 217 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 218 | fn lquery_strrust-analyzer cargo postgres-protocol 0.6.12 types/test/lquery_str().() { |
| 219 | let mut query = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1u8]; |
| 220 | query.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().("A.B.C".as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()); |
| 221 | |
| 222 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(lquery_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/lquery_from_sql().(query.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().()).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().()) |
| 223 | } |
| 224 | |
| 225 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 226 | fn lquery_wrong_versionrust-analyzer cargo postgres-protocol 0.6.12 types/test/lquery_wrong_version().() { |
| 227 | let mut query = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![2u8]; |
| 228 | query.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().("A.B.C".as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()); |
| 229 | |
| 230 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(lquery_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/lquery_from_sql().(query.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().()).is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()) |
| 231 | } |
| 232 | |
| 233 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 234 | fn ltxtquery_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/test/ltxtquery_sql().() { |
| 235 | let mut query = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1u8]; |
| 236 | query.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().("a & b*".as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()); |
| 237 | |
| 238 | let mut buf = BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#::newrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut]new().(); |
| 239 | |
| 240 | ltree_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/ltree_to_sql().("a & b*", &mut buf); |
| 241 | |
| 242 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(query.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().(), buf.chunkrust-analyzer cargo bytes 1.11.1 bytes_mut/impl#[BytesMut][Buf]chunk().()); |
| 243 | } |
| 244 | |
| 245 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 246 | fn ltxtquery_strrust-analyzer cargo postgres-protocol 0.6.12 types/test/ltxtquery_str().() { |
| 247 | let mut query = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1u8]; |
| 248 | query.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().("a & b*".as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()); |
| 249 | |
| 250 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(ltree_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/ltree_from_sql().(query.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().()).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().()) |
| 251 | } |
| 252 | |
| 253 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 254 | fn ltxtquery_wrong_versionrust-analyzer cargo postgres-protocol 0.6.12 types/test/ltxtquery_wrong_version().() { |
| 255 | let mut query = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![2u8]; |
| 256 | query.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().("a & b*".as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()); |
| 257 | |
| 258 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(ltree_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/ltree_from_sql().(query.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().()).is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()) |
| 259 | } |