pub struct NewTopic { /* private fields */ }Expand description
Definition of one Kafka topic to create.
Implementations§
Source§impl NewTopic
impl NewTopic
Sourcepub fn new(
name: impl Into<String>,
num_partitions: i32,
replication_factor: i16,
) -> Self
pub fn new( name: impl Into<String>, num_partitions: i32, replication_factor: i16, ) -> Self
Creates a topic using automatic replica assignment.
Sourcepub fn with_assignments(
name: impl Into<String>,
assignments: impl IntoIterator<Item = (i32, Vec<i32>)>,
) -> Self
pub fn with_assignments( name: impl Into<String>, assignments: impl IntoIterator<Item = (i32, Vec<i32>)>, ) -> Self
Creates a topic using explicit partition-to-broker assignments.
Kafka requires partition count and replication factor to be -1 when
manual assignments are supplied.
Sourcepub fn config(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn config(self, name: impl Into<String>, value: impl Into<String>) -> Self
Adds or replaces a topic configuration value.
Sourcepub fn nullable_config(
self,
name: impl Into<String>,
value: Option<String>,
) -> Self
pub fn nullable_config( self, name: impl Into<String>, value: Option<String>, ) -> Self
Adds or replaces a nullable topic configuration value.
Sourcepub fn num_partitions(&self) -> i32
pub fn num_partitions(&self) -> i32
Returns the requested partition count, or -1 for manual assignment.
Sourcepub fn replication_factor(&self) -> i16
pub fn replication_factor(&self) -> i16
Returns the requested replication factor, or -1 for manual assignment.
Trait Implementations§
impl Eq for NewTopic
impl StructuralPartialEq for NewTopic
Auto Trait Implementations§
impl Freeze for NewTopic
impl RefUnwindSafe for NewTopic
impl Send for NewTopic
impl Sync for NewTopic
impl Unpin for NewTopic
impl UnsafeUnpin for NewTopic
impl UnwindSafe for NewTopic
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