pulsar_binary_protocol_spec/protos/
utils.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
use super::protobuf::pulsar_api::KeyValue;

pub(crate) fn convert_tuple_slice_to_key_value_vector(slice: &[(&str, &str)]) -> Vec<KeyValue> {
    slice
        .iter()
        .map(|(k, v)| {
            let mut kv = KeyValue::new();
            kv.set_key(k.to_owned().into());
            kv.set_value(v.to_owned().into());
            kv
        })
        .collect::<Vec<_>>()
}