Struct rdkafka::topic_partition_list::TopicPartitionList
source · pub struct TopicPartitionList { /* private fields */ }
Expand description
A structure to store and manipulate a list of topics and partitions with optional offsets.
Implementations§
source§impl TopicPartitionList
impl TopicPartitionList
sourcepub fn new() -> TopicPartitionList
pub fn new() -> TopicPartitionList
Creates a new empty list with default capacity.
sourcepub fn with_capacity(capacity: usize) -> TopicPartitionList
pub fn with_capacity(capacity: usize) -> TopicPartitionList
Creates a new empty list with the specified capacity.
sourcepub fn from_topic_map(
topic_map: &HashMap<(String, i32), Offset>,
) -> KafkaResult<TopicPartitionList>
pub fn from_topic_map( topic_map: &HashMap<(String, i32), Offset>, ) -> KafkaResult<TopicPartitionList>
Given a topic map, generates a new TopicPartitionList
.
sourcepub fn ptr(&self) -> *mut RDKafkaTopicPartitionList
pub fn ptr(&self) -> *mut RDKafkaTopicPartitionList
Returns the pointer to the internal librdkafka structure.
sourcepub fn add_topic_unassigned<'a>(
&'a mut self,
topic: &str,
) -> TopicPartitionListElem<'a>
pub fn add_topic_unassigned<'a>( &'a mut self, topic: &str, ) -> TopicPartitionListElem<'a>
Adds a topic with unassigned partitions to the list.
sourcepub fn add_partition<'a>(
&'a mut self,
topic: &str,
partition: i32,
) -> TopicPartitionListElem<'a>
pub fn add_partition<'a>( &'a mut self, topic: &str, partition: i32, ) -> TopicPartitionListElem<'a>
Adds a topic and partition to the list.
sourcepub fn add_partition_range(
&mut self,
topic: &str,
start_partition: i32,
stop_partition: i32,
)
pub fn add_partition_range( &mut self, topic: &str, start_partition: i32, stop_partition: i32, )
Adds a topic and partition range to the list.
sourcepub fn set_partition_offset(
&mut self,
topic: &str,
partition: i32,
offset: Offset,
) -> KafkaResult<()>
pub fn set_partition_offset( &mut self, topic: &str, partition: i32, offset: Offset, ) -> KafkaResult<()>
Sets the offset for an already created topic partition. It will fail if the topic partition isn’t in the list.
sourcepub fn add_partition_offset(
&mut self,
topic: &str,
partition: i32,
offset: Offset,
) -> KafkaResult<()>
pub fn add_partition_offset( &mut self, topic: &str, partition: i32, offset: Offset, ) -> KafkaResult<()>
Adds a topic and partition to the list, with the specified offset.
sourcepub fn find_partition(
&self,
topic: &str,
partition: i32,
) -> Option<TopicPartitionListElem<'_>>
pub fn find_partition( &self, topic: &str, partition: i32, ) -> Option<TopicPartitionListElem<'_>>
Given a topic name and a partition number, returns the corresponding list element.
sourcepub fn set_all_offsets(&mut self, offset: Offset) -> Result<(), KafkaError>
pub fn set_all_offsets(&mut self, offset: Offset) -> Result<(), KafkaError>
Sets all partitions in the list to the specified offset.
sourcepub fn elements(&self) -> Vec<TopicPartitionListElem<'_>>
pub fn elements(&self) -> Vec<TopicPartitionListElem<'_>>
Returns all the elements of the list.
sourcepub fn elements_for_topic<'a>(
&'a self,
topic: &str,
) -> Vec<TopicPartitionListElem<'a>>
pub fn elements_for_topic<'a>( &'a self, topic: &str, ) -> Vec<TopicPartitionListElem<'a>>
Returns all the elements of the list that belong to the specified topic.
Trait Implementations§
source§impl Clone for TopicPartitionList
impl Clone for TopicPartitionList
source§impl Debug for TopicPartitionList
impl Debug for TopicPartitionList
source§impl Default for TopicPartitionList
impl Default for TopicPartitionList
source§impl PartialEq for TopicPartitionList
impl PartialEq for TopicPartitionList
impl Send for TopicPartitionList
impl Sync for TopicPartitionList
Auto Trait Implementations§
impl Freeze for TopicPartitionList
impl RefUnwindSafe for TopicPartitionList
impl Unpin for TopicPartitionList
impl UnwindSafe for TopicPartitionList
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
)