| 1 | 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/::{selfrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/, Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#, LowerHexrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/LowerHex#, Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#}; |
| 2 | |
| 3 | const HEX_CHARSrust-analyzer cargo postgres-protocol 0.6.12 hex/HEX_CHARS.: &[u8; 16] = b"0123456789abcdef"; |
| 4 | |
| 5 | pub(craterust-analyzer cargo postgres-protocol 0.6.12 crate/) struct LowerHexWrapperrust-analyzer cargo postgres-protocol 0.6.12 hex/LowerHexWrapper#<T>(pub T); |
| 6 | |
| 7 | impl<T: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[u8]>> LowerHexrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/LowerHex# for LowerHexWrapperrust-analyzer cargo postgres-protocol 0.6.12 hex/LowerHexWrapper#<T> { |
| 8 | fn fmtrust-analyzer cargo postgres-protocol 0.6.12 hex/impl#[`LowerHexWrapper<T>`][LowerHex]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# { |
| 9 | for &b in self.0rust-analyzer cargo postgres-protocol 0.6.12 hex/LowerHexWrapper#0..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().() { |
| 10 | let [a, b] = encode_byterust-analyzer cargo postgres-protocol 0.6.12 hex/encode_byte().(b); |
| 11 | f.write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'_>`][Write]write_char().(char::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/convert/impl#[char][`From<u8>`]from().(a))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 12 | f.write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'_>`][Write]write_char().(char::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/convert/impl#[char][`From<u8>`]from().(b))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 13 | } |
| 14 | |
| 15 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | const fn encode_byterust-analyzer cargo postgres-protocol 0.6.12 hex/encode_byte().(byte: u8) -> [u8; 2] { |
| 20 | [lower_nibble_to_hexrust-analyzer cargo postgres-protocol 0.6.12 hex/lower_nibble_to_hex().(byte rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr().4), lower_nibble_to_hexrust-analyzer cargo postgres-protocol 0.6.12 hex/lower_nibble_to_hex().(byte)] |
| 21 | } |
| 22 | |
| 23 | const fn lower_nibble_to_hexrust-analyzer cargo postgres-protocol 0.6.12 hex/lower_nibble_to_hex().(half_byte: u8) -> u8 { |
| 24 | HEX_CHARSrust-analyzer cargo postgres-protocol 0.6.12 hex/HEX_CHARS.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().(half_byte rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().0x0F) as usize]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). |
| 25 | } |