mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-02-19 14:17:53 +01:00
17 lines
480 B
Rust
17 lines
480 B
Rust
use std::collections::HashMap;
|
|
|
|
use KeyAndValueRef::{Ascii, Binary};
|
|
|
|
use yaak_grpc::{KeyAndValueRef, MetadataMap};
|
|
|
|
pub fn metadata_to_map(metadata: MetadataMap) -> HashMap<String, String> {
|
|
let mut entries = HashMap::new();
|
|
for r in metadata.iter() {
|
|
match r {
|
|
Ascii(k, v) => entries.insert(k.to_string(), v.to_str().unwrap().to_string()),
|
|
Binary(k, v) => entries.insert(k.to_string(), format!("{:?}", v)),
|
|
};
|
|
}
|
|
entries
|
|
}
|