Skip to main content

SubscriptionOptionsBuilder

Struct SubscriptionOptionsBuilder 

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

Fluent builder for SubscriptionOptions: every parameter has a setter, and Self::build checks that the mandatory ones were set.

Implementations§

Source§

impl SubscriptionOptionsBuilder

Source

pub fn new() -> Self

Creates a builder with every mandatory parameter unset and every other parameter at the value Java passes on the caller’s behalf.

§Returns

The new builder.

Source

pub fn set_topics(self, topics: Vec<String>) -> Self

Sets SubscriptionOptions::topics, a mandatory parameter: Self::build returns an error if it was not set.

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

This builder.

Source

pub fn set_user_data(self, user_data: Option<Vec<u8>>) -> Self

Sets SubscriptionOptions::user_data.

§Arguments
  • user_data - Nullable user data to include in the subscription
§Returns

This builder.

Source

pub fn set_owned_partitions(self, owned_partitions: Vec<TopicPartition>) -> Self

Sets SubscriptionOptions::owned_partitions.

§Arguments
  • owned_partitions - The partitions currently owned by this consumer
§Returns

This builder.

Source

pub fn set_generation_id(self, generation_id: i32) -> Self

Sets SubscriptionOptions::generation_id.

§Arguments
  • generation_id - The generation ID of the consumer group
§Returns

This builder.

Source

pub fn set_rack_id(self, rack_id: Option<String>) -> Self

Sets SubscriptionOptions::rack_id.

§Arguments
  • rack_id - Optional rack ID for rack-aware assignment
§Returns

This builder.

Source

pub fn build(self) -> Result<SubscriptionOptions, Error>

Returns the built options.

§Errors
  • Error::is_local_illegal_argument_error naming the first mandatory parameter (today only topics) that was not set.

Trait Implementations§

Source§

impl Debug for SubscriptionOptionsBuilder

Source§

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

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

impl Default for SubscriptionOptionsBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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, 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