Skip to main content

Subscription

Struct Subscription 

Source
pub struct Subscription { /* private fields */ }
Expand description

Represents a consumer’s subscription information including topics, user data, and owned partitions.

Implementations§

Source§

impl Subscription

Source

pub fn new(topics: Vec<String>) -> Self

Constructs a basic subscription with only topics.

§Arguments
  • topics - The list of topics to subscribe to
§Returns

The new Subscription.

Source

pub fn with_user_data(topics: Vec<String>, user_data: Option<Vec<u8>>) -> Self

Constructs a subscription without owned partitions.

§Arguments
  • topics - The list of topics to subscribe to
  • user_data - Nullable user data to include in the subscription
§Returns

The new Subscription.

Source

pub fn with_user_data_owned_partitions( topics: Vec<String>, user_data: Option<Vec<u8>>, owned_partitions: Vec<TopicPartition>, ) -> Self

Constructs a subscription without generation ID and rack ID.

§Arguments
  • topics - The list of topics to subscribe to
  • user_data - Nullable user data to include in the subscription
  • owned_partitions - The partitions currently owned by this consumer
§Returns

The new Subscription.

Source

pub fn with_options(options: SubscriptionOptions) -> Self

Constructs a subscription with full details.

§Arguments
  • options - The topics, user data, owned partitions, generation ID and rack ID
§Returns

The new Subscription.

Source

pub fn topics(&self) -> &[String]

The subscribed topics.

§Returns

The list of topics

Source

pub fn user_data(&self) -> Option<&[u8]>

The opaque user data attached to the subscription.

§Returns

The user data, or None if none was provided

Source

pub fn owned_partitions(&self) -> &[TopicPartition]

The partitions currently owned by the member.

§Returns

The list of owned partitions

Source

pub fn rack_id(&self) -> Option<&str>

The rack id of the member, if any.

§Returns

The rack ID, or empty if not provided

Source

pub fn set_group_instance_id(&mut self, group_instance_id: Option<String>)

Sets the group instance id.

§Arguments
  • group_instance_id - The group instance ID
Source

pub fn group_instance_id(&self) -> Option<&str>

The group instance id of the member, if any.

§Returns

The group instance ID, or empty if this is a dynamic member

Source

pub fn generation_id(&self) -> Option<i32>

The generation id of the subscription, if any.

§Returns

The generation ID, or empty if not provided

Trait Implementations§

Source§

impl Clone for Subscription

Source§

fn clone(&self) -> Subscription

Returns a duplicate 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 Subscription

Source§

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

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

impl Display for Subscription

Source§

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

Formats the value using the given formatter. 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§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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>,

Source§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V