| 1 | mod buf_mutrust-analyzer cargo sqlx-postgres 0.8.3 io/buf_mut/; |
| 2 | |
| 3 | pub use buf_mutrust-analyzer cargo sqlx-postgres 0.8.3 io/buf_mut/::PgBufMutExtrust-analyzer cargo sqlx-postgres 0.8.3 io/buf_mut/PgBufMutExt#; |
| 4 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/; |
| 5 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::{Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#, Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#}; |
| 6 | 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/::{NonZeroU32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU32#, Saturatingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/Saturating#}; |
| 7 | |
| 8 | pub(craterust-analyzer cargo sqlx-postgres 0.8.3 crate/) use sqlx_corerust-analyzer cargo sqlx-core 0.8.3 crate/::iorust-analyzer cargo sqlx-core 0.8.3 io/::*; |
| 9 | |
| 10 | #[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:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, 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:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 11 | pub(craterust-analyzer cargo sqlx-postgres 0.8.3 crate/) struct StatementIdrust-analyzer cargo sqlx-postgres 0.8.3 io/StatementId#(IdInnerrust-analyzer cargo sqlx-postgres 0.8.3 io/IdInner#); |
| 12 | |
| 13 | #[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:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, 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:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 14 | pub(craterust-analyzer cargo sqlx-postgres 0.8.3 crate/) struct PortalIdrust-analyzer cargo sqlx-postgres 0.8.3 io/PortalId#(IdInnerrust-analyzer cargo sqlx-postgres 0.8.3 io/IdInner#); |
| 15 | |
| 16 | #[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:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, 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:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 17 | struct IdInnerrust-analyzer cargo sqlx-postgres 0.8.3 io/IdInner#(Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<NonZeroU32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU32#>); |
| 18 | |
| 19 | pub(craterust-analyzer cargo sqlx-postgres 0.8.3 crate/) struct DisplayIdrust-analyzer cargo sqlx-postgres 0.8.3 io/DisplayId# { |
| 20 | prefixrust-analyzer cargo sqlx-postgres 0.8.3 io/DisplayId#prefix.: &'static str, |
| 21 | idrust-analyzer cargo sqlx-postgres 0.8.3 io/DisplayId#id.: NonZeroU32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU32#, |
| 22 | } |
| 23 | |
| 24 | impl StatementIdrust-analyzer cargo sqlx-postgres 0.8.3 io/StatementId# { |
| 25 | #[allow(dead_code)] |
| 26 | pub const UNNAMEDrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]UNNAMED.: Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId] = Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId](IdInnerrust-analyzer cargo sqlx-postgres 0.8.3 io/IdInner#::UNNAMEDrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]UNNAMED.); |
| 27 | |
| 28 | pub const NAMED_STARTrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]NAMED_START.: Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId] = Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId](IdInnerrust-analyzer cargo sqlx-postgres 0.8.3 io/IdInner#::NAMED_STARTrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]NAMED_START.); |
| 29 | |
| 30 | #[cfg(test)] |
| 31 | pub const TEST_VALrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]TEST_VAL.: Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId] = Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId](IdInnerrust-analyzer cargo sqlx-postgres 0.8.3 io/IdInner#::TEST_VALrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]TEST_VAL.); |
| 32 | |
| 33 | const NAME_PREFIXrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]NAME_PREFIX.: &'static str = "sqlx_s_"; |
| 34 | |
| 35 | pub fn nextrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]next().(&self) -> Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId] { |
| 36 | Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId](self.0rust-analyzer cargo sqlx-postgres 0.8.3 io/StatementId#0..nextrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]next().()) |
| 37 | } |
| 38 | |
| 39 | pub fn name_lenrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]name_len().(&self) -> Saturatingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/Saturating#<usize> { |
| 40 | self.0rust-analyzer cargo sqlx-postgres 0.8.3 io/StatementId#0..name_lenrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]name_len().(Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]::NAME_PREFIXrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]NAME_PREFIX.) |
| 41 | } |
| 42 | |
| 43 | /// Get a type to format this statement ID with [`Display`]. |
| 44 | /// |
| 45 | /// Returns `None` if this is the unnamed statement. |
| 46 | #[inline(always)] |
| 47 | pub fn displayrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]display().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DisplayIdrust-analyzer cargo sqlx-postgres 0.8.3 io/DisplayId#> { |
| 48 | self.0rust-analyzer cargo sqlx-postgres 0.8.3 io/StatementId#0..displayrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]display().(Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]::NAME_PREFIXrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]NAME_PREFIX.) |
| 49 | } |
| 50 | |
| 51 | pub fn put_name_with_nulrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]put_name_with_nul().(&self, buf: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>) { |
| 52 | self.0rust-analyzer cargo sqlx-postgres 0.8.3 io/StatementId#0..put_name_with_nulrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]put_name_with_nul().(Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]::NAME_PREFIXrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]NAME_PREFIX., buf) |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for DisplayIdrust-analyzer cargo sqlx-postgres 0.8.3 io/DisplayId# { |
| 57 | fn fmtrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[DisplayId][Display]fmt().(&self, f: &mut Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 58 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}{}", self.prefixrust-analyzer cargo sqlx-postgres 0.8.3 io/DisplayId#prefix., self.idrust-analyzer cargo sqlx-postgres 0.8.3 io/DisplayId#id.) |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | #[allow(dead_code)] |
| 63 | impl PortalIdrust-analyzer cargo sqlx-postgres 0.8.3 io/PortalId# { |
| 64 | // None selects the unnamed portal |
| 65 | pub const UNNAMEDrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId]UNNAMED.: Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId] = PortalIdrust-analyzer cargo sqlx-postgres 0.8.3 io/PortalId#(IdInnerrust-analyzer cargo sqlx-postgres 0.8.3 io/IdInner#::UNNAMEDrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]UNNAMED.); |
| 66 | |
| 67 | pub const NAMED_STARTrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId]NAMED_START.: Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId] = PortalIdrust-analyzer cargo sqlx-postgres 0.8.3 io/PortalId#(IdInnerrust-analyzer cargo sqlx-postgres 0.8.3 io/IdInner#::NAMED_STARTrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]NAMED_START.); |
| 68 | |
| 69 | #[cfg(test)] |
| 70 | pub const TEST_VALrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId]TEST_VAL.: Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId] = Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId](IdInnerrust-analyzer cargo sqlx-postgres 0.8.3 io/IdInner#::TEST_VALrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]TEST_VAL.); |
| 71 | |
| 72 | const NAME_PREFIXrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId]NAME_PREFIX.: &'static str = "sqlx_p_"; |
| 73 | |
| 74 | /// If ID represents a named portal, return the next ID, wrapping on overflow. |
| 75 | /// |
| 76 | /// If this ID represents the unnamed portal, return the same. |
| 77 | pub fn nextrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId]next().(&self) -> Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId] { |
| 78 | Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId](self.0rust-analyzer cargo sqlx-postgres 0.8.3 io/PortalId#0..nextrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]next().()) |
| 79 | } |
| 80 | |
| 81 | /// Calculate the number of bytes that will be written by [`Self::put_name_with_nul()`]. |
| 82 | pub fn name_lenrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId]name_len().(&self) -> Saturatingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/Saturating#<usize> { |
| 83 | self.0rust-analyzer cargo sqlx-postgres 0.8.3 io/PortalId#0..name_lenrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]name_len().(Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId]::NAME_PREFIXrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId]NAME_PREFIX.) |
| 84 | } |
| 85 | |
| 86 | pub fn put_name_with_nulrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId]put_name_with_nul().(&self, buf: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>) { |
| 87 | self.0rust-analyzer cargo sqlx-postgres 0.8.3 io/PortalId#0..put_name_with_nulrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]put_name_with_nul().(Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId]::NAME_PREFIXrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId]NAME_PREFIX., buf) |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | impl IdInnerrust-analyzer cargo sqlx-postgres 0.8.3 io/IdInner# { |
| 92 | const UNNAMEDrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]UNNAMED.: Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner] = Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner](Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 93 | |
| 94 | const NAMED_STARTrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]NAMED_START.: Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner] = Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner](Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(NonZeroU32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU32#::MINrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<u32>`]MIN.)); |
| 95 | |
| 96 | #[cfg(test)] |
| 97 | pub const TEST_VALrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]TEST_VAL.: Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner] = Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner](NonZeroU32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU32#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<T>`]new().(1234567890)); |
| 98 | |
| 99 | #[inline(always)] |
| 100 | fn nextrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]next().(&self) -> Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner] { |
| 101 | Selfrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]( |
| 102 | self.0rust-analyzer cargo sqlx-postgres 0.8.3 io/IdInner#0. |
| 103 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|id| id.checked_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<u32>`]checked_add().(1).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(NonZeroU32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU32#::MINrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<u32>`]MIN.)), |
| 104 | ) |
| 105 | } |
| 106 | |
| 107 | #[inline(always)] |
| 108 | fn displayrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]display().(&self, prefix: &'static str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DisplayIdrust-analyzer cargo sqlx-postgres 0.8.3 io/DisplayId#> { |
| 109 | self.0rust-analyzer cargo sqlx-postgres 0.8.3 io/IdInner#0..maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|id| DisplayIdrust-analyzer cargo sqlx-postgres 0.8.3 io/DisplayId# { prefixrust-analyzer cargo sqlx-postgres 0.8.3 io/DisplayId#prefix., idrust-analyzer cargo sqlx-postgres 0.8.3 io/DisplayId#id. }) |
| 110 | } |
| 111 | |
| 112 | #[inline(always)] |
| 113 | fn name_lenrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]name_len().(&self, name_prefix: &str) -> Saturatingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/Saturating#<usize> { |
| 114 | let mut len = Saturatingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/Saturating#(0); |
| 115 | |
| 116 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(id) = self.0rust-analyzer cargo sqlx-postgres 0.8.3 io/IdInner#0. { |
| 117 | len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<usize>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<usize>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<usize>`]add_assign().name_prefix.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().(); |
| 118 | // estimate the length of the ID in decimal |
| 119 | // `.ilog10()` can't panic since the value is never zero |
| 120 | len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<usize>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<usize>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<usize>`]add_assign().id.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<T>`]get().().ilog10rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]ilog10().() as usize; |
| 121 | // add one to compensate for `ilog10()` rounding down. |
| 122 | len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<usize>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<usize>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<usize>`]add_assign().1; |
| 123 | } |
| 124 | |
| 125 | // count the NUL terminator |
| 126 | len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<usize>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<usize>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/saturating/impl#[`Saturating<usize>`][`AddAssign<usize>`]add_assign().1; |
| 127 | |
| 128 | len |
| 129 | } |
| 130 | |
| 131 | #[inline(always)] |
| 132 | fn put_name_with_nulrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[IdInner]put_name_with_nul().(&self, name_prefix: &str, buf: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>) { |
| 133 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(id) = self.0rust-analyzer cargo sqlx-postgres 0.8.3 io/IdInner#0. { |
| 134 | buf.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(name_prefix.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()); |
| 135 | buf.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(itoarust-analyzer cargo itoa 1.0.18 crate/::Bufferrust-analyzer cargo itoa 1.0.18 Buffer#::newrust-analyzer cargo itoa 1.0.18 impl#[Buffer]new().().formatrust-analyzer cargo itoa 1.0.18 impl#[Buffer]format().(id.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<T>`]get().()).as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()); |
| 136 | } |
| 137 | |
| 138 | buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(0); |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 143 | fn statement_id_display_matches_encodingrust-analyzer cargo sqlx-postgres 0.8.3 io/statement_id_display_matches_encoding().() { |
| 144 | const EXPECTED_STRrust-analyzer cargo sqlx-postgres 0.8.3 io/EXPECTED_STR.: &str = "sqlx_s_1234567890"; |
| 145 | const EXPECTED_BYTESrust-analyzer cargo sqlx-postgres 0.8.3 io/EXPECTED_BYTES.: &[u8] = b"sqlx_s_1234567890\0"; |
| 146 | |
| 147 | let mut bytes = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 148 | |
| 149 | StatementIdrust-analyzer cargo sqlx-postgres 0.8.3 io/StatementId#::TEST_VALrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]TEST_VAL..put_name_with_nulrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]put_name_with_nul().(&mut bytes); |
| 150 | |
| 151 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes, EXPECTED_BYTESrust-analyzer cargo sqlx-postgres 0.8.3 io/EXPECTED_BYTES.); |
| 152 | |
| 153 | let str = StatementIdrust-analyzer cargo sqlx-postgres 0.8.3 io/StatementId#::TEST_VALrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]TEST_VAL..displayrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]display().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 154 | |
| 155 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(str, EXPECTED_STRrust-analyzer cargo sqlx-postgres 0.8.3 io/EXPECTED_STR.); |
| 156 | } |