Struct sea_streamer_kafka::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

source

pub fn new() -> TopicPartitionList

Creates a new empty list with default capacity.

source

pub fn with_capacity(capacity: usize) -> TopicPartitionList

Creates a new empty list with the specified capacity.

source

pub fn from_topic_map( topic_map: &HashMap<(String, i32), Offset> ) -> Result<TopicPartitionList, KafkaError>

Given a topic map, generates a new TopicPartitionList.

source

pub fn ptr(&self) -> *mut rd_kafka_topic_partition_list_s

Returns the pointer to the internal librdkafka structure.

source

pub fn count(&self) -> usize

Returns the number of elements in the list.

source

pub fn capacity(&self) -> usize

Returns the capacity of the list.

source

pub fn add_topic_unassigned<'a>( &'a mut self, topic: &str ) -> TopicPartitionListElem<'a>

Adds a topic with unassigned partitions to the list.

source

pub fn add_partition<'a>( &'a mut self, topic: &str, partition: i32 ) -> TopicPartitionListElem<'a>

Adds a topic and partition to the list.

source

pub fn add_partition_range( &mut self, topic: &str, start_partition: i32, stop_partition: i32 )

Adds a topic and partition range to the list.

source

pub fn set_partition_offset( &mut self, topic: &str, partition: i32, offset: Offset ) -> Result<(), KafkaError>

Sets the offset for an already created topic partition. It will fail if the topic partition isnโ€™t in the list.

source

pub fn add_partition_offset( &mut self, topic: &str, partition: i32, offset: Offset ) -> Result<(), KafkaError>

Adds a topic and partition to the list, with the specified offset.

source

pub fn find_partition( &self, topic: &str, partition: i32 ) -> Option<TopicPartitionListElem<'_>>

Given a topic name and a partition number, returns the corresponding list element.

source

pub fn set_all_offsets(&mut self, offset: Offset) -> Result<(), KafkaError>

Sets all partitions in the list to the specified offset.

source

pub fn elements(&self) -> Vec<TopicPartitionListElem<'_>>

Returns all the elements of the list.

source

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.

source

pub fn to_topic_map(&self) -> HashMap<(String, i32), Offset>

Returns a hashmap-based representation of the list.

Trait Implementationsยง

sourceยง

impl Clone for TopicPartitionList

sourceยง

fn clone(&self) -> TopicPartitionList

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 TopicPartitionList

sourceยง

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

Formats the value using the given formatter. Read more
sourceยง

impl Default for TopicPartitionList

sourceยง

fn default() -> TopicPartitionList

Returns the โ€œdefault valueโ€ for a type. Read more
sourceยง

impl PartialEq for TopicPartitionList

sourceยง

fn eq(&self, other: &TopicPartitionList) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 ยท sourceยง

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
sourceยง

impl Send for TopicPartitionList

sourceยง

impl Sync for TopicPartitionList

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> From<T> for T

sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

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.