| 1 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::iorust-analyzer cargo sqlx-postgres 0.8.3 io/::{PgBufMutExtrust-analyzer cargo sqlx-postgres 0.8.3 io/buf_mut/PgBufMutExt#, PortalIdrust-analyzer cargo sqlx-postgres 0.8.3 io/PortalId#, StatementIdrust-analyzer cargo sqlx-postgres 0.8.3 io/StatementId#}; |
| 2 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::messagerust-analyzer cargo sqlx-postgres 0.8.3 message/::{FrontendMessagerust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessage#, FrontendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessageFormat#}; |
| 3 | 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#; |
| 4 | |
| 5 | const CLOSE_PORTALrust-analyzer cargo sqlx-postgres 0.8.3 message/close/CLOSE_PORTAL.: u8 = b'P'; |
| 6 | const CLOSE_STATEMENTrust-analyzer cargo sqlx-postgres 0.8.3 message/close/CLOSE_STATEMENT.: u8 = b'S'; |
| 7 | |
| 8 | #[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:)] |
| 9 | #[allow(dead_code)] |
| 10 | pub enum Closerust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close# { |
| 11 | Statementrust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close#Statement#(StatementIdrust-analyzer cargo sqlx-postgres 0.8.3 io/StatementId#), |
| 12 | Portalrust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close#Portal#(PortalIdrust-analyzer cargo sqlx-postgres 0.8.3 io/PortalId#), |
| 13 | } |
| 14 | |
| 15 | impl FrontendMessagerust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessage# for Closerust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close# { |
| 16 | const FORMATrust-analyzer cargo sqlx-postgres 0.8.3 message/close/impl#[Close][FrontendMessage]FORMAT.: FrontendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessageFormat# = FrontendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessageFormat#::Closerust-analyzer cargo sqlx-postgres 0.8.3 message/FrontendMessageFormat#Close#; |
| 17 | |
| 18 | fn body_size_hintrust-analyzer cargo sqlx-postgres 0.8.3 message/close/impl#[Close][FrontendMessage]body_size_hint().(&self) -> Saturatingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/Saturating#<usize> { |
| 19 | // Either `CLOSE_PORTAL` or `CLOSE_STATEMENT` |
| 20 | let mut size = Saturatingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/Saturating#(1); |
| 21 | |
| 22 | match self { |
| 23 | Closerust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close#::Statementrust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close#Statement#(id) => size rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<Self>`]add_assign().id.name_lenrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]name_len().(), |
| 24 | Closerust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close#::Portalrust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close#Portal#(id) => size rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<Self>`]add_assign().id.name_lenrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId]name_len().(), |
| 25 | } |
| 26 | |
| 27 | size |
| 28 | } |
| 29 | |
| 30 | fn encode_bodyrust-analyzer cargo sqlx-postgres 0.8.3 message/close/impl#[Close][FrontendMessage]encode_body().(&self, buf: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 31 | match self { |
| 32 | Closerust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close#::Statementrust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close#Statement#(id) => { |
| 33 | buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(CLOSE_STATEMENTrust-analyzer cargo sqlx-postgres 0.8.3 message/close/CLOSE_STATEMENT.); |
| 34 | buf.put_statement_namerust-analyzer cargo sqlx-postgres 0.8.3 io/buf_mut/impl#[`Vec<u8>`][PgBufMutExt]put_statement_name().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().id); |
| 35 | } |
| 36 | |
| 37 | Closerust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close#::Portalrust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close#Portal#(id) => { |
| 38 | buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(CLOSE_PORTALrust-analyzer cargo sqlx-postgres 0.8.3 message/close/CLOSE_PORTAL.); |
| 39 | buf.put_portal_namerust-analyzer cargo sqlx-postgres 0.8.3 io/buf_mut/impl#[`Vec<u8>`][PgBufMutExt]put_portal_name().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().id); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 44 | } |
| 45 | } |