Debian Codegraph @

src/message/copy.rs

raw symbols SCIP
1 use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::errorrust-analyzer cargo sqlx-postgres 0.8.3 error/::Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#;
2 use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::iorust-analyzer cargo sqlx-postgres 0.8.3 io/::BufMutExtrust-analyzer cargo sqlx-core 0.8.3 io/buf_mut/BufMutExt#;
3 use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::messagerust-analyzer cargo sqlx-postgres 0.8.3 message/::{
4 BackendMessagerust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessage#, BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#, FrontendMessagerust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessage#, FrontendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessageFormat#,
5 };
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#, Bytesrust-analyzer cargo bytes 1.12.1 bytes/Bytes#};
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/::numrust-analyzer cargo std https://github.com/rust-lang/rust/library/std num/::Saturatingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/Saturating#;
9 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#;
10
11 /// The same structure is sent for both `CopyInResponse` and `CopyOutResponse`
12 pub struct CopyResponseDatarust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyResponseData# {
13 pub formatrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyResponseData#format.: i8,
14 pub num_columnsrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyResponseData#num_columns.: i16,
15 pub format_codesrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyResponseData#format_codes.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i16>,
16 }
17
18 pub struct CopyInResponserust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyInResponse#(pub CopyResponseDatarust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyResponseData#);
19
20 #[allow(dead_code)]
21 pub struct CopyOutResponserust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyOutResponse#(pub CopyResponseDatarust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyResponseData#);
22
23 pub struct CopyDatarust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyData#<B>(pub B);
24
25 pub struct CopyFailrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyFail# {
26 pub messagerust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyFail#message.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
27 }
28
29 pub struct CopyDonerust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyDone#;
30
31 impl CopyResponseDatarust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyResponseData# {
32 #[inline]
33 fn decoderust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyResponseData]decode().(mut buf: Bytesrust-analyzer cargo bytes 1.12.1 bytes/Bytes#) -> Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#<Selfrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyResponseData]> {
34 let format = buf.get_i8rust-analyzer cargo bytes 1.12.1 buf/buf_impl/Buf#get_i8().();
35 let num_columns = buf.get_i16rust-analyzer cargo bytes 1.12.1 buf/buf_impl/Buf#get_i16().();
36
37 let format_codes = (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#num_columns).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|_| buf.get_i16rust-analyzer cargo bytes 1.12.1 buf/buf_impl/Buf#get_i16().()).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
38
39 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(CopyResponseDatarust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyResponseData# {
40 formatrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyResponseData#format.,
41 num_columnsrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyResponseData#num_columns.,
42 format_codesrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyResponseData#format_codes.,
43 })
44 }
45 }
46
47 impl BackendMessagerust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessage# for CopyInResponserust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyInResponse# {
48 const FORMATrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyInResponse][BackendMessage]FORMAT.: BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat# = BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::CopyInResponserust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#CopyInResponse#;
49
50 #[inline(always)]
51 fn decode_bodyrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyInResponse][BackendMessage]decode_body().(buf: Bytesrust-analyzer cargo bytes 1.12.1 bytes/Bytes#) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyInResponse][BackendMessage], Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> {
52 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyInResponse][BackendMessage](CopyResponseDatarust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyResponseData#::decoderust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyResponseData]decode().(buf)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().))
53 }
54 }
55
56 impl BackendMessagerust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessage# for CopyOutResponserust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyOutResponse# {
57 const FORMATrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyOutResponse][BackendMessage]FORMAT.: BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat# = BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::CopyOutResponserust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#CopyOutResponse#;
58
59 #[inline(always)]
60 fn decode_bodyrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyOutResponse][BackendMessage]decode_body().(buf: Bytesrust-analyzer cargo bytes 1.12.1 bytes/Bytes#) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyOutResponse][BackendMessage], Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> {
61 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyOutResponse][BackendMessage](CopyResponseDatarust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyResponseData#::decoderust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyResponseData]decode().(buf)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().))
62 }
63 }
64
65 impl BackendMessagerust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessage# for CopyDatarust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyData#<Bytesrust-analyzer cargo bytes 1.12.1 bytes/Bytes#> {
66 const FORMATrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[`CopyData<Bytes>`][BackendMessage]FORMAT.: BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat# = BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::CopyDatarust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#CopyData#;
67
68 #[inline(always)]
69 fn decode_bodyrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[`CopyData<Bytes>`][BackendMessage]decode_body().(buf: Bytesrust-analyzer cargo bytes 1.12.1 bytes/Bytes#) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[`CopyData<Bytes>`][BackendMessage], Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> {
70 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[`CopyData<Bytes>`][BackendMessage](buf))
71 }
72 }
73
74 impl<B: Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#<Targetrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#Target# = [u8]>> FrontendMessagerust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessage# for CopyDatarust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyData#<B> {
75 const FORMATrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[`CopyData<B>`][FrontendMessage]FORMAT.: FrontendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessageFormat# = FrontendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessageFormat#::CopyDatarust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessageFormat#CopyData#;
76
77 #[inline(always)]
78 fn body_size_hintrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[`CopyData<B>`][FrontendMessage]body_size_hint().(&self) -> Saturatingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/Saturating#<usize> {
79 Saturatingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/Saturating#(self.0rust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyData#0..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().())
80 }
81
82 #[inline(always)]
83 fn encode_bodyrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[`CopyData<B>`][FrontendMessage]encode_body().(&self, buf: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>) -> Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#<(), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> {
84 buf.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(&self.0rust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyData#0.);
85 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
86 }
87 }
88
89 impl FrontendMessagerust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessage# for CopyFailrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyFail# {
90 const FORMATrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyFail][FrontendMessage]FORMAT.: FrontendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessageFormat# = FrontendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessageFormat#::CopyFailrust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessageFormat#CopyFail#;
91
92 #[inline(always)]
93 fn body_size_hintrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyFail][FrontendMessage]body_size_hint().(&self) -> Saturatingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/Saturating#<usize> {
94 Saturatingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/Saturating#(self.messagerust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyFail#message..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().())
95 }
96
97 #[inline(always)]
98 fn encode_bodyrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyFail][FrontendMessage]encode_body().(&self, buf: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> {
99 buf.put_str_nulrust-analyzer cargo sqlx-core 0.8.3 io/buf_mut/impl#[`Vec<u8>`][BufMutExt]put_str_nul().(&self.messagerust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyFail#message.);
100 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
101 }
102 }
103
104 impl CopyFailrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyFail# {
105 #[inline(always)]
106 pub fn newrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyFail]new().(msg: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>) -> CopyFailrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyFail# {
107 CopyFailrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyFail# {
108 messagerust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyFail#message.: msg.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(),
109 }
110 }
111 }
112
113 impl FrontendMessagerust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessage# for CopyDonerust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyDone# {
114 const FORMATrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyDone][FrontendMessage]FORMAT.: FrontendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessageFormat# = FrontendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessageFormat#::CopyDonerust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessageFormat#CopyDone#;
115 #[inline(always)]
116 fn body_size_hintrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyDone][FrontendMessage]body_size_hint().(&self) -> Saturatingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/Saturating#<usize> {
117 Saturatingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/Saturating#(0)
118 }
119
120 #[inline(always)]
121 fn encode_bodyrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyDone][FrontendMessage]encode_body().(&self, _buf: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> {
122 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
123 }
124 }
125
126 impl BackendMessagerust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessage# for CopyDonerust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyDone# {
127 const FORMATrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyDone][BackendMessage]FORMAT.: BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat# = BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::CopyDonerust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#CopyDone#;
128
129 #[inline(always)]
130 fn decode_bodyrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyDone][BackendMessage]decode_body().(bytes: Bytesrust-analyzer cargo bytes 1.12.1 bytes/Bytes#) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-postgres 0.8.3 message/copy/impl#[CopyDone][BackendMessage], Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> {
131 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().bytes.is_emptyrust-analyzer cargo bytes 1.12.1 bytes/impl#[Bytes]is_empty().() {
132 // Not fatal but may indicate a protocol change
133 tracingrust-analyzer cargo tracing 0.1.44 crate/::debugrust-analyzer cargo tracing 0.1.44 macros/debug!!(
134 "Postgres backend returned non-empty message for CopyDone: \"{}\"",
135 bytes.escape_asciirust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/ascii/impl#[`[u8]`]escape_ascii().()
136 )
137 }
138
139 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(CopyDonerust-analyzer cargo sqlx-postgres 0.8.3 message/copy/CopyDone#)
140 }
141 }