| 1 | use bytesrust-analyzer cargo bytes 1.12.1 crate/::{Bufrust-analyzer cargo bytes 1.12.1 buf/buf_impl/Buf#, Bytesrust-analyzer cargo bytes 1.12.1 bytes/Bytes#}; |
| 2 | |
| 3 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::columnrust-analyzer cargo sqlx-mysql 0.8.3 column/::MySqlColumnrust-analyzer cargo sqlx-mysql 0.8.3 column/MySqlColumn#; |
| 4 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::errorrust-analyzer cargo sqlx-mysql 0.8.3 error/::Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#; |
| 5 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::iorust-analyzer cargo sqlx-mysql 0.8.3 io/::MySqlBufExtrust-analyzer cargo sqlx-mysql 0.8.3 io/buf/MySqlBufExt#; |
| 6 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::iorust-analyzer cargo sqlx-mysql 0.8.3 io/::ProtocolDecoderust-analyzer cargo sqlx-core 0.8.3 io/decode/ProtocolDecode#; |
| 7 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::protocolrust-analyzer cargo sqlx-mysql 0.8.3 protocol/::Rowrust-analyzer cargo sqlx-mysql 0.8.3 protocol/row/Row#; |
| 8 | |
| 9 | #[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:)] |
| 10 | pub(craterust-analyzer cargo sqlx-mysql 0.8.3 crate/) struct TextRowrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/row/TextRow#(pub(craterust-analyzer cargo sqlx-mysql 0.8.3 crate/) Rowrust-analyzer cargo sqlx-mysql 0.8.3 protocol/row/Row#); |
| 11 | |
| 12 | impl<'de> ProtocolDecoderust-analyzer cargo sqlx-core 0.8.3 io/decode/ProtocolDecode#<'de, &'de [MySqlColumnrust-analyzer cargo sqlx-mysql 0.8.3 column/MySqlColumn#]> for TextRowrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/row/TextRow# { |
| 13 | fn decode_withrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/row/impl#[TextRow][`ProtocolDecode<'de, &'de [MySqlColumn]>`]decode_with().(mut buf: Bytesrust-analyzer cargo bytes 1.12.1 bytes/Bytes#, columns: &'de [MySqlColumnrust-analyzer cargo sqlx-mysql 0.8.3 column/MySqlColumn#]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/row/impl#[TextRow][`ProtocolDecode<'de, &'de [MySqlColumn]>`], Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 14 | let storage = buf.clonerust-analyzer cargo bytes 1.12.1 bytes/impl#[Bytes][Clone]clone().(); |
| 15 | let offset = buf.lenrust-analyzer cargo bytes 1.12.1 bytes/impl#[Bytes]len().(); |
| 16 | |
| 17 | let mut values = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(columns.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()); |
| 18 | |
| 19 | for _ in columns { |
| 20 | if buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]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 cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().0xfb { |
| 21 | // NULL is sent as 0xfb |
| 22 | values.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 23 | buf.advancerust-analyzer cargo bytes 1.12.1 bytes/impl#[Bytes][Buf]advance().(1); |
| 24 | } else { |
| 25 | let size = buf.get_uint_lenencrust-analyzer cargo sqlx-mysql 0.8.3 io/buf/impl#[Bytes][MySqlBufExt]get_uint_lenenc().(); |
| 26 | let size = usize::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/ptr_try_from_impls/impl#[usize][`TryFrom<u64>`]try_from().(size) |
| 27 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| err_protocolrust-analyzer cargo sqlx-core 0.8.3 error/err_protocol!!("TextRow length out of range: {size}"))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 28 | |
| 29 | let offset = offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().buf.lenrust-analyzer cargo bytes 1.12.1 bytes/impl#[Bytes]len().(); |
| 30 | |
| 31 | values.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(offset..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#(offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().size))); |
| 32 | |
| 33 | buf.advancerust-analyzer cargo bytes 1.12.1 bytes/impl#[Bytes][Buf]advance().(size); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(TextRowrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/row/TextRow#(Rowrust-analyzer cargo sqlx-mysql 0.8.3 protocol/row/Row# { valuesrust-analyzer cargo sqlx-mysql 0.8.3 protocol/row/Row#values., storagerust-analyzer cargo sqlx-mysql 0.8.3 protocol/row/Row#storage. })) |
| 38 | } |
| 39 | } |