Struct rdkafka::config::ClientConfig

source ·
pub struct ClientConfig {
    pub log_level: RDKafkaLogLevel,
    /* private fields */
}
Expand description

Client configuration.

Fields§

§log_level: RDKafkaLogLevel

The librdkafka logging level. Refer to RDKafkaLogLevel for the list of available levels.

Implementations§

source§

impl ClientConfig

source

pub fn new() -> ClientConfig

Creates a new empty configuration.

source

pub fn get(&self, key: &str) -> Option<&str>

Gets the value of a parameter in the configuration.

Returns the current value set for key, or None if no value for key exists.

Note that this method will only ever return values that were installed by a call to ClientConfig::set. To retrieve librdkafka’s default value for a parameter, build a NativeClientConfig and then call NativeClientConfig::get on the resulting object.

source

pub fn set<K, V>(&mut self, key: K, value: V) -> &mut ClientConfig
where K: Into<String>, V: Into<String>,

Sets a parameter in the configuration.

If there is an existing value for key in the configuration, it is overridden with the new value.

source

pub fn remove<'a>(&'a mut self, key: &str) -> &'a mut ClientConfig

Removes a parameter from the configuration.

source

pub fn set_log_level(&mut self, log_level: RDKafkaLogLevel) -> &mut ClientConfig

Sets the log level of the client. If not specified, the log level will be calculated based on the global log level of the log crate.

source

pub fn create_native_config(&self) -> KafkaResult<NativeClientConfig>

Builds a native librdkafka configuration.

source

pub fn create<T: FromClientConfig>(&self) -> KafkaResult<T>

Uses the current configuration to create a new Consumer or Producer.

source

pub fn create_with_context<C, T>(&self, context: C) -> KafkaResult<T>

Uses the current configuration and the provided context to create a new Consumer or Producer.

Trait Implementations§

source§

impl Clone for ClientConfig

source§

fn clone(&self) -> ClientConfig

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 ClientConfig

source§

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

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

impl Default for ClientConfig

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Extend<(String, String)> for ClientConfig

source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = (String, String)>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl FromIterator<(String, String)> for ClientConfig

source§

fn from_iter<I>(iter: I) -> ClientConfig
where I: IntoIterator<Item = (String, String)>,

Creates a value from an iterator. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

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 T
where 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 T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more