Struct grpcio::Metadata[][src]

#[repr(C)]
pub struct Metadata(_);
Expand description

A collection of metadata entries that can be exchanged during a call.

gRPC supports these types of metadata:

  • Request headers

    They are sent by the client at the beginning of a remote call before any request messages are sent.

  • Response headers

    They are sent by the server at the beginning of a remote call handler before any response messages are sent.

  • Response trailers

    They are sent by the server at the end of a remote call along with resulting call status.

Metadata value can be ascii string or bytes. They are distinguish by the key suffix, key of bytes value should have suffix ‘-bin’.

Implementations

impl Metadata[src]

pub fn len(&self) -> usize[src]

Returns the count of metadata entries.

pub fn is_empty(&self) -> bool[src]

Returns true if there is no metadata entries.

pub fn get(&self, index: usize) -> Option<(&str, &[u8])>[src]

Returns the metadata entry at the index.

None is returned if out of bound.

pub fn iter(&self) -> MetadataIter<'_>

Notable traits for MetadataIter<'a>

impl<'a> Iterator for MetadataIter<'a> type Item = (&'a str, &'a [u8]);
[src]

Returns an iterator over the metadata entries.

pub fn into_raw_parts(self) -> (*mut grpc_metadata, usize, usize)[src]

Decomposes a Metadata array into its raw components.

Returns the raw pointer to the underlying data, the length of the vector (in elements), and the allocated capacity of the data (in elements). These are the same arguments in the same order as the arguments to from_raw_parts.

After calling this function, the caller is responsible for the memory previously managed by the Metadata. The only way to do this is to convert the raw pointer, length, and capacity back into a Metadata with the from_raw_parts function, allowing the destructor to perform the cleanup.

pub unsafe fn from_raw_parts(
    p: *mut grpc_metadata,
    len: usize,
    cap: usize
) -> Metadata
[src]

Creates a Metadata directly from the raw components of another vector.

Safety

The operation is safe only if the three arguments are returned from into_raw_parts and only convert once.

Trait Implementations

impl Clone for Metadata[src]

fn clone(&self) -> Metadata[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Drop for Metadata[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

impl<'a> IntoIterator for &'a Metadata[src]

type IntoIter = MetadataIter<'a>

Which kind of iterator are we turning this into?

type Item = (&'a str, &'a [u8])

The type of the elements being iterated over.

fn into_iter(self) -> MetadataIter<'a>

Notable traits for MetadataIter<'a>

impl<'a> Iterator for MetadataIter<'a> type Item = (&'a str, &'a [u8]);
[src]

Creates an iterator from a value. Read more

impl Send for Metadata[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.