pub struct CloseOptions { /* private fields */ }Expand description
Options for closing a consumer.
Corresponds to Java’s org.apache.kafka.clients.consumer.CloseOptions.
Implementations§
Source§impl CloseOptions
impl CloseOptions
Sourcepub const DEFAULT_CLOSE_TIMEOUT_MS: u64 = 30_000
pub const DEFAULT_CLOSE_TIMEOUT_MS: u64 = 30_000
Default timeout (milliseconds) applied when CloseOptions::timeout is
not set. In Java this constant lives in ConsumerUtils; we expose it here
for now and a later phase will move it to its canonical location and
re-export from there.
NOTE: Phase 6 will move this constant to a ConsumerUtils translation
and re-export it here for backwards compatibility.
Sourcepub fn new_timeout(timeout: Duration) -> Self
pub fn new_timeout(timeout: Duration) -> Self
Static method to create a CloseOptions with a custom timeout.
Corresponds to Java’s static CloseOptions.timeout(Duration). Java
accepts a nullable Duration here and internally wraps it via
Optional.ofNullable; Rust’s type system makes Duration non-null,
so for “no timeout, use default” callers should use
CloseOptions::default (or omit the call to new_timeout).
Sourcepub fn new_group_membership_operation(
operation: GroupMembershipOperation,
) -> Self
pub fn new_group_membership_operation( operation: GroupMembershipOperation, ) -> Self
Static method to create a CloseOptions with a specified group
membership operation.
Corresponds to Java’s static
CloseOptions.groupMembershipOperation(GroupMembershipOperation).
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Fluent setter for the close timeout.
Corresponds to Java’s CloseOptions.withTimeout(Duration) which
accepts a nullable Duration. In Rust, Duration is non-null; the
internal Option<Duration> field always becomes Some(timeout)
after this call. Callers wanting “no timeout, use default” should
leave the field at its default by skipping this setter (or via
CloseOptions::default).
Sourcepub fn with_group_membership_operation(
self,
operation: GroupMembershipOperation,
) -> Self
pub fn with_group_membership_operation( self, operation: GroupMembershipOperation, ) -> Self
Fluent setter for the group membership operation upon shutdown.
In Java, this method rejects a null operation via
Objects.requireNonNull. In Rust the type system makes the
non-null guarantee redundant.
Sourcepub fn group_membership_operation(&self) -> GroupMembershipOperation
pub fn group_membership_operation(&self) -> GroupMembershipOperation
The group membership operation to apply upon shutdown.
Trait Implementations§
Source§impl Clone for CloseOptions
impl Clone for CloseOptions
Source§fn clone(&self) -> CloseOptions
fn clone(&self) -> CloseOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CloseOptions
impl Debug for CloseOptions
Source§impl Default for CloseOptions
impl Default for CloseOptions
Source§impl PartialEq for CloseOptions
impl PartialEq for CloseOptions
impl Eq for CloseOptions
impl StructuralPartialEq for CloseOptions
Auto Trait Implementations§
impl Freeze for CloseOptions
impl RefUnwindSafe for CloseOptions
impl Send for CloseOptions
impl Sync for CloseOptions
impl Unpin for CloseOptions
impl UnsafeUnpin for CloseOptions
impl UnwindSafe for CloseOptions
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.