Skip to content

Commit

Permalink
impl Clone for MetadataBuilder (#638)
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas BESSOU <[email protected]>
  • Loading branch information
Ten0 authored May 7, 2024
1 parent 3c2dbca commit b82c902
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,17 @@ impl MetadataBuilder {
}
}

impl Clone for MetadataBuilder {
fn clone(&self) -> MetadataBuilder {
let mut builder = MetadataBuilder::with_capacity(self.arr.0.capacity);
for (k, v) in self.arr.iter() {
// use `add_metadata` to skip validation.
builder.add_metadata(k, v);
}
builder
}
}

/// A collection of metadata entries that can be exchanged during a call.
///
/// gRPC supports these types of metadata:
Expand Down

0 comments on commit b82c902

Please sign in to comment.