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
impl ClientConfig
sourcepub fn new() -> ClientConfig
pub fn new() -> ClientConfig
Creates a new empty configuration.
sourcepub fn get(&self, key: &str) -> Option<&str>
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.
sourcepub fn set<K, V>(&mut self, key: K, value: V) -> &mut ClientConfig
pub fn set<K, V>(&mut self, key: K, value: V) -> &mut ClientConfig
Sets a parameter in the configuration.
If there is an existing value for key
in the configuration, it is
overridden with the new value
.
sourcepub fn remove<'a>(&'a mut self, key: &str) -> &'a mut ClientConfig
pub fn remove<'a>(&'a mut self, key: &str) -> &'a mut ClientConfig
Removes a parameter from the configuration.
sourcepub fn set_log_level(&mut self, log_level: RDKafkaLogLevel) -> &mut ClientConfig
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.
sourcepub fn create_native_config(&self) -> KafkaResult<NativeClientConfig>
pub fn create_native_config(&self) -> KafkaResult<NativeClientConfig>
Builds a native librdkafka configuration.
sourcepub fn create<T: FromClientConfig>(&self) -> KafkaResult<T>
pub fn create<T: FromClientConfig>(&self) -> KafkaResult<T>
Uses the current configuration to create a new Consumer or Producer.
sourcepub fn create_with_context<C, T>(&self, context: C) -> KafkaResult<T>where
C: ClientContext,
T: FromClientConfigAndContext<C>,
pub fn create_with_context<C, T>(&self, context: C) -> KafkaResult<T>where
C: ClientContext,
T: FromClientConfigAndContext<C>,
Uses the current configuration and the provided context to create a new Consumer or Producer.
Trait Implementations§
source§impl Clone for ClientConfig
impl Clone for ClientConfig
source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ClientConfig
impl Debug for ClientConfig
source§impl Default for ClientConfig
impl Default for ClientConfig
source§impl Extend<(String, String)> for ClientConfig
impl Extend<(String, String)> for ClientConfig
source§fn extend<I>(&mut self, iter: I)
fn extend<I>(&mut self, iter: I)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl FromIterator<(String, String)> for ClientConfig
impl FromIterator<(String, String)> for ClientConfig
source§fn from_iter<I>(iter: I) -> ClientConfig
fn from_iter<I>(iter: I) -> ClientConfig
Auto Trait Implementations§
impl Freeze for ClientConfig
impl RefUnwindSafe for ClientConfig
impl Send for ClientConfig
impl Sync for ClientConfig
impl Unpin for ClientConfig
impl UnwindSafe for ClientConfig
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)