#[non_exhaustive]pub struct ProtocolFeatures {
pub rate_limit_error: Option<i32>,
pub lwt_optimization_meta_bit_mask: Option<u32>,
pub tablets_v1_supported: bool,
}
Expand description
Which protocol extensions are supported by the server.
This is used to inform the server about the features that the client supports, so that the server can adjust its behavior accordingly.
So to draw the picture:
- server responds to an
OPTIONS
frame with aSUPPORTED
frame with the list of protocol features it supports; - client parses the
SUPPORTED
frame by extracting extensions it recognizes (supports) and creates aProtocolFeatures
instance; - from now on, client uses this instance to determine how to handle certain frames, e.g. whether to expect a rate limit error or how to handle LWT operations;
- client also adds the features it supports to the
STARTUP
frame and sends it to the server, which finishes the extensions negotiation process.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.rate_limit_error: Option<i32>
The error code to use for rate limit errors, if negotiated.
lwt_optimization_meta_bit_mask: Option<u32>
The bit mask used for the LWT optimization, if negotiated. This is used to mark PREPARED response frames as related to LWT operations in order to to optimize the handling of LWT requests.
The mask is ANDed with the flags of the PREPARED response frame, and if the result is equal to the mask, it means that the frame is related to an LWT operation.
tablets_v1_supported: bool
Whether the server supports tablets routing v1.
Implementations§
Source§impl ProtocolFeatures
impl ProtocolFeatures
Sourcepub fn parse_from_supported(supported: &HashMap<String, Vec<String>>) -> Self
pub fn parse_from_supported(supported: &HashMap<String, Vec<String>>) -> Self
Parses the supported protocol features from the supported
map.
Sourcepub fn add_startup_options(
&self,
options: &mut HashMap<Cow<'_, str>, Cow<'_, str>>,
)
pub fn add_startup_options( &self, options: &mut HashMap<Cow<'_, str>, Cow<'_, str>>, )
Adds the protocol features as STARTUP options.
Sourcepub fn prepared_flags_contain_lwt_mark(&self, flags: u32) -> bool
pub fn prepared_flags_contain_lwt_mark(&self, flags: u32) -> bool
Checks if the given flags of a PREPARED response contain the LWT optimization mark.
If the extension was not negotiated, it conservatively returns false
.
Trait Implementations§
Source§impl Clone for ProtocolFeatures
impl Clone for ProtocolFeatures
Source§fn clone(&self) -> ProtocolFeatures
fn clone(&self) -> ProtocolFeatures
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ProtocolFeatures
impl Debug for ProtocolFeatures
Source§impl Default for ProtocolFeatures
impl Default for ProtocolFeatures
Source§fn default() -> ProtocolFeatures
fn default() -> ProtocolFeatures
Source§impl PartialEq for ProtocolFeatures
impl PartialEq for ProtocolFeatures
impl Copy for ProtocolFeatures
impl Eq for ProtocolFeatures
impl StructuralPartialEq for ProtocolFeatures
Auto Trait Implementations§
impl Freeze for ProtocolFeatures
impl RefUnwindSafe for ProtocolFeatures
impl Send for ProtocolFeatures
impl Sync for ProtocolFeatures
impl Unpin for ProtocolFeatures
impl UnwindSafe for ProtocolFeatures
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§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more