#[repr(C)]
pub struct grpc_metadata_credentials_plugin { pub get_metadata: Option<unsafe extern "C" fn(state: *mut c_void, context: grpc_auth_metadata_context, cb: grpc_credentials_plugin_metadata_cb, user_data: *mut c_void, creds_md: *mut grpc_metadata, num_creds_md: *mut usize, status: *mut Type, error_details: *mut *const c_char) -> c_int>, pub debug_string: Option<unsafe extern "C" fn(state: *mut c_void) -> *mut c_char>, pub destroy: Option<unsafe extern "C" fn(state: *mut c_void)>, pub state: *mut c_void, pub type_: *const c_char, }
Expand description

grpc_metadata_credentials plugin is an API user provided structure used to create grpc_credentials objects that can be set on a channel (composed) or a call. See grpc_credentials_metadata_create_from_plugin below. The grpc client stack will call the get_metadata method of the plugin for every call in scope for the credentials created from it.

Fields§

§get_metadata: Option<unsafe extern "C" fn(state: *mut c_void, context: grpc_auth_metadata_context, cb: grpc_credentials_plugin_metadata_cb, user_data: *mut c_void, creds_md: *mut grpc_metadata, num_creds_md: *mut usize, status: *mut Type, error_details: *mut *const c_char) -> c_int>

The implementation of this method has to be non-blocking, but can be performed synchronously or asynchronously.

If processing occurs synchronously, returns non-zero and populates creds_md, num_creds_md, status, and error_details. In this case, the caller takes ownership of the entries in creds_md and of error_details. Note that if the plugin needs to return more than GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX entries in creds_md, it must return asynchronously.

If processing occurs asynchronously, returns zero and invokes \a cb when processing is completed. \a user_data will be passed as the first parameter of the callback. NOTE: \a cb MUST be invoked in a different thread, not from the thread in which \a get_metadata() is invoked.

\a context is the information that can be used by the plugin to create auth metadata.

§debug_string: Option<unsafe extern "C" fn(state: *mut c_void) -> *mut c_char>

Implements debug string of the given plugin. This method returns an allocated string that the caller needs to free using gpr_free()

§destroy: Option<unsafe extern "C" fn(state: *mut c_void)>

Destroys the plugin state.

§state: *mut c_void

State that will be set as the first parameter of the methods above.

§type_: *const c_char

Type of credentials that this plugin is implementing.

Trait Implementations§

source§

impl Clone for grpc_metadata_credentials_plugin

source§

fn clone(&self) -> grpc_metadata_credentials_plugin

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for grpc_metadata_credentials_plugin

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for grpc_metadata_credentials_plugin

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.