| 1 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::{ |
| 2 | borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/::Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#, |
| 3 | fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/, |
| 4 | hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/::{BuildHasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasher#, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#}, |
| 5 | }; |
| 6 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::{BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#, HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#}; |
| 7 | |
| 8 | use craterust-analyzer cargo runtime-format 0.1.3 crate/::{FormatKeyrust-analyzer cargo runtime-format 0.1.3 FormatKey#, FormatKeyErrorrust-analyzer cargo runtime-format 0.1.3 FormatKeyError#}; |
| 9 | |
| 10 | impl<K, V, S> FormatKeyrust-analyzer cargo runtime-format 0.1.3 FormatKey# for HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<K, V, S> |
| 11 | where |
| 12 | K: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<str> + Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# + Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#, |
| 13 | V: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#, |
| 14 | S: BuildHasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasher#, |
| 15 | { |
| 16 | fn fmtrust-analyzer cargo runtime-format 0.1.3 alloc_impls/impl#[`HashMap<K, V, S>`][FormatKey]fmt().(&self, key: &str, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), FormatKeyErrorrust-analyzer cargo runtime-format 0.1.3 FormatKeyError#> { |
| 17 | match self.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(key) { |
| 18 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(v) => v.fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#fmt().(f).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(FormatKeyErrorrust-analyzer cargo runtime-format 0.1.3 FormatKeyError#::Fmtrust-analyzer cargo runtime-format 0.1.3 FormatKeyError#Fmt#), |
| 19 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(FormatKeyErrorrust-analyzer cargo runtime-format 0.1.3 FormatKeyError#::UnknownKeyrust-analyzer cargo runtime-format 0.1.3 FormatKeyError#UnknownKey#), |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | impl<K, V> FormatKeyrust-analyzer cargo runtime-format 0.1.3 FormatKey# for BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<K, V> |
| 25 | where |
| 26 | K: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<str> + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 27 | V: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#, |
| 28 | { |
| 29 | fn fmtrust-analyzer cargo runtime-format 0.1.3 alloc_impls/impl#[`BTreeMap<K, V>`][FormatKey]fmt().(&self, key: &str, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), FormatKeyErrorrust-analyzer cargo runtime-format 0.1.3 FormatKeyError#> { |
| 30 | match self.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(key) { |
| 31 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(v) => v.fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#fmt().(f).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(FormatKeyErrorrust-analyzer cargo runtime-format 0.1.3 FormatKeyError#::Fmtrust-analyzer cargo runtime-format 0.1.3 FormatKeyError#Fmt#), |
| 32 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(FormatKeyErrorrust-analyzer cargo runtime-format 0.1.3 FormatKeyError#::UnknownKeyrust-analyzer cargo runtime-format 0.1.3 FormatKeyError#UnknownKey#), |
| 33 | } |
| 34 | } |
| 35 | } |