fn req_cloner<T: Clone>(cloneme: &tonic::Request<T>) -> tonic::Request<T> {
    let msg = cloneme.get_ref().clone();
    let mut new_req = tonic::Request::new(msg);
    let new_met = new_req.metadata_mut();
    for kv in cloneme.metadata().iter() {
        match kv {
            KeyAndValueRef::Ascii(k, v) => {
                new_met.insert(k, v.clone());
            }
            KeyAndValueRef::Binary(k, v) => {
                new_met.insert_bin(k, v.clone());
            }
        }
    }
    new_req
}
/// Helper for cloning a tonic request as long as the inner message may be cloned.
/// We drop extensions, so, lang bridges can't pass those in :shrug:
Helper for cloning a tonic request as long as the inner message may be cloned.
We drop extensions, so, lang bridges can't pass those in :shrug.
Helper for cloning a tonic request as long as the inner message may be cloned . We drop extensions so lang bridges can ' t pass those in : shrug .
fn req_cloner<T: Clone>(cloneme: &tonic::Request<T>) -> tonic::Request<T> {
    let msg = cloneme.get_ref().clone();
    let mut new_req = tonic::Request::new(msg);
    let new_met = new_req.metadata_mut();
    for kv in cloneme.metadata().iter() {
        match kv {
            KeyAndValueRef::Ascii(k, v) => {
                new_met.insert(k, v.clone());
            }
            KeyAndValueRef::Binary(k, v) => {
                new_met.insert_bin(k, v.clone());
            }
        }
    }
    new_req
}
fn req_cloner < T : Clone > ( cloneme : & tonic :: Request < T > ) -> tonic :: Request < T > { let msg = cloneme . get_ref ( ) . clone ( ) ; let mut new_req = tonic :: Request :: new ( msg ) ; let new_met = new_req . metadata_mut ( ) ; for kv in cloneme . metadata ( ) . iter ( ) { match kv { KeyAndValueRef :: Ascii ( k , v ) => { new_met . insert ( k , v . clone ( ) ) ; } KeyAndValueRef :: Binary ( k , v ) => { new_met . insert_bin ( k , v . clone ( ) ) ; } } } new_req }
Helper for cloning a tonic request as long as the inner message may be cloned.
Helper for cloning a tonic request as long as the inner message may be cloned .
cloneme
&tonic::Request<T>
cloneme
&tonic::Request<T>