pub struct Metadata { /* private fields */ }Expand description
Metadata for one call. Keys are lowercase, as HTTP/2 requires.
Implementations§
Source§impl Metadata
impl Metadata
pub fn new() -> Metadata
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Sourcepub fn insert(&mut self, key: &str, value: impl Into<String>) -> &mut Self
pub fn insert(&mut self, key: &str, value: impl Into<String>) -> &mut Self
Set an ASCII value, replacing any existing entries for the key.
Sourcepub fn insert_bin(&mut self, key: &str, value: impl Into<Vec<u8>>) -> &mut Self
pub fn insert_bin(&mut self, key: &str, value: impl Into<Vec<u8>>) -> &mut Self
Set a binary value. The key must end in -bin, which is the gRPC signal
that the value is base64 on the wire.
Sourcepub fn append(&mut self, key: &str, value: impl Into<String>) -> &mut Self
pub fn append(&mut self, key: &str, value: impl Into<String>) -> &mut Self
Add a value without removing existing ones — gRPC metadata is multi-valued.
pub fn remove(&mut self, key: &str)
pub fn iter(&self) -> impl Iterator<Item = (&str, &MetadataValue)>
Sourcepub fn to_headers(&self) -> Vec<(String, String)>
pub fn to_headers(&self) -> Vec<(String, String)>
Render to wire headers, base64-encoding every -bin value.
Trait Implementations§
impl Eq for Metadata
impl StructuralPartialEq for Metadata
Auto Trait Implementations§
impl Freeze for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnsafeUnpin for Metadata
impl UnwindSafe for Metadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more