#[non_exhaustive]pub enum Message<I, A> {
Ping(Ping<I, A>),
IndirectPing(IndirectPing<I, A>),
Ack(Ack),
Suspect(Suspect<I>),
Alive(Alive<I, A>),
Dead(Dead<I>),
PushPull(PushPull<I, A>),
UserData(Bytes),
Nack(Nack),
ErrorResponse(ErrorResponse),
}Expand description
Request to be sent to the Raft node.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Ping(Ping<I, A>)
Ping message
IndirectPing(IndirectPing<I, A>)
Indirect ping message
Ack(Ack)
Ack response message
Suspect(Suspect<I>)
Suspect message
Alive(Alive<I, A>)
Alive message
Dead(Dead<I>)
Dead message
PushPull(PushPull<I, A>)
PushPull message
UserData(Bytes)
User mesg, not handled by us
Nack(Nack)
Nack response message
ErrorResponse(ErrorResponse)
Error response message
Implementations§
Source§impl<I, A> Message<I, A>
impl<I, A> Message<I, A>
Sourcepub const INDIRECTPING_TAG: u8 = 2u8
pub const INDIRECTPING_TAG: u8 = 2u8
The tag of IndirectPing message.
Sourcepub const SUSPECT_TAG: u8 = 4u8
pub const SUSPECT_TAG: u8 = 4u8
The tag of Suspect message.
Sourcepub const PUSHPULL_TAG: u8 = 7u8
pub const PUSHPULL_TAG: u8 = 7u8
The tag of PushPull message.
Sourcepub const USERDATA_TAG: u8 = 8u8
pub const USERDATA_TAG: u8 = 8u8
The tag of Bytes message.
Sourcepub const ERRORRESPONSE_TAG: u8 = 10u8
pub const ERRORRESPONSE_TAG: u8 = 10u8
The tag of ErrorResponse message.
Sourcepub fn unwrap_ping(self) -> Ping<I, A>
pub fn unwrap_ping(self) -> Ping<I, A>
Sourcepub fn try_unwrap_ping(self) -> Option<Ping<I, A>>
pub fn try_unwrap_ping(self) -> Option<Ping<I, A>>
Sourcepub fn unwrap_indirect_ping(self) -> IndirectPing<I, A>
pub fn unwrap_indirect_ping(self) -> IndirectPing<I, A>
Returns the contained IndirectPing message, consuming the self value. Panics if the value is not IndirectPing.
Sourcepub fn try_unwrap_indirect_ping(self) -> Option<IndirectPing<I, A>>
pub fn try_unwrap_indirect_ping(self) -> Option<IndirectPing<I, A>>
Returns the contained IndirectPing message, consuming the self value. Returns None if the value is not IndirectPing.
Sourcepub const fn indirect_ping(val: IndirectPing<I, A>) -> Self
pub const fn indirect_ping(val: IndirectPing<I, A>) -> Self
Construct a Message from IndirectPing.
Sourcepub fn unwrap_ack(self) -> Ack
pub fn unwrap_ack(self) -> Ack
Sourcepub fn try_unwrap_ack(self) -> Option<Ack>
pub fn try_unwrap_ack(self) -> Option<Ack>
Sourcepub fn unwrap_suspect(self) -> Suspect<I>
pub fn unwrap_suspect(self) -> Suspect<I>
Sourcepub fn try_unwrap_suspect(self) -> Option<Suspect<I>>
pub fn try_unwrap_suspect(self) -> Option<Suspect<I>>
Sourcepub fn unwrap_alive(self) -> Alive<I, A>
pub fn unwrap_alive(self) -> Alive<I, A>
Sourcepub fn try_unwrap_alive(self) -> Option<Alive<I, A>>
pub fn try_unwrap_alive(self) -> Option<Alive<I, A>>
Sourcepub fn unwrap_dead(self) -> Dead<I>
pub fn unwrap_dead(self) -> Dead<I>
Sourcepub fn try_unwrap_dead(self) -> Option<Dead<I>>
pub fn try_unwrap_dead(self) -> Option<Dead<I>>
Sourcepub fn unwrap_push_pull(self) -> PushPull<I, A>
pub fn unwrap_push_pull(self) -> PushPull<I, A>
Sourcepub fn try_unwrap_push_pull(self) -> Option<PushPull<I, A>>
pub fn try_unwrap_push_pull(self) -> Option<PushPull<I, A>>
Sourcepub fn unwrap_user_data(self) -> Bytes
pub fn unwrap_user_data(self) -> Bytes
Sourcepub fn try_unwrap_user_data(self) -> Option<Bytes>
pub fn try_unwrap_user_data(self) -> Option<Bytes>
Sourcepub fn unwrap_nack(self) -> Nack
pub fn unwrap_nack(self) -> Nack
Sourcepub fn try_unwrap_nack(self) -> Option<Nack>
pub fn try_unwrap_nack(self) -> Option<Nack>
Sourcepub fn unwrap_error_response(self) -> ErrorResponse
pub fn unwrap_error_response(self) -> ErrorResponse
Returns the contained ErrorResponse message, consuming the self value. Panics if the value is not ErrorResponse.
Sourcepub fn try_unwrap_error_response(self) -> Option<ErrorResponse>
pub fn try_unwrap_error_response(self) -> Option<ErrorResponse>
Returns the contained ErrorResponse message, consuming the self value. Returns None if the value is not ErrorResponse.
Sourcepub const fn error_response(val: ErrorResponse) -> Self
pub const fn error_response(val: ErrorResponse) -> Self
Construct a Message from ErrorResponse.
Source§impl<I, A> Message<I, A>
impl<I, A> Message<I, A>
Sourcepub const RESERVED_TAG_RANGE: RangeInclusive<u8>
pub const RESERVED_TAG_RANGE: RangeInclusive<u8>
Defines the range of reserved tags for message types.
This constant specifies a range of tag values that are reserved for internal use
by the Message enum variants. When implementing custom
with Wire or Transport,
it is important to ensure that any custom header added to the message bytes does not
start with a tag value within this reserved range.
The reserved range is 0..=128, meaning that the first byte of any custom message
must not fall within this range to avoid conflicts with predefined message types.
§Note
Adhering to this constraint is crucial for ensuring that custom messages
are correctly distinguishable from the standard messages defined by the Message enum.
Failing to do so may result in incorrect message parsing and handling.
Sourcepub const COMPOUND_TAG: u8 = 0u8
pub const COMPOUND_TAG: u8 = 0u8
Returns the tag of the compound message type for encoding/decoding.
Trait Implementations§
Source§impl<'de, I, A> Deserialize<'de> for Message<I, A>where
I: Deserialize<'de>,
A: Deserialize<'de>,
impl<'de, I, A> Deserialize<'de> for Message<I, A>where
I: Deserialize<'de>,
A: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<I, A> From<ErrorResponse> for Message<I, A>
impl<I, A> From<ErrorResponse> for Message<I, A>
Source§fn from(value: ErrorResponse) -> Self
fn from(value: ErrorResponse) -> Self
Source§impl<I, A> From<IndirectPing<I, A>> for Message<I, A>
impl<I, A> From<IndirectPing<I, A>> for Message<I, A>
Source§fn from(value: IndirectPing<I, A>) -> Self
fn from(value: IndirectPing<I, A>) -> Self
Source§impl<I, A> Transformable for Message<I, A>
impl<I, A> Transformable for Message<I, A>
Source§type Error = MessageTransformError<I, A>
type Error = MessageTransformError<I, A>
Source§fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>where
Self: Sized,
fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>where
Self: Sized,
std only.Source§async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>(
reader: &mut R,
) -> Result<(usize, Self)>where
Self: Sized,
async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>(
reader: &mut R,
) -> Result<(usize, Self)>where
Self: Sized,
async only.Source§fn encode_to_vec(&self) -> Result<Vec<u8>, Self::Error>
fn encode_to_vec(&self) -> Result<Vec<u8>, Self::Error>
alloc or std only.impl<I: Eq, A: Eq> Eq for Message<I, A>
impl<I, A> StructuralPartialEq for Message<I, A>
Auto Trait Implementations§
impl<I, A> !Freeze for Message<I, A>
impl<I, A> RefUnwindSafe for Message<I, A>where
I: RefUnwindSafe,
A: RefUnwindSafe,
impl<I, A> Send for Message<I, A>
impl<I, A> Sync for Message<I, A>
impl<I, A> Unpin for Message<I, A>
impl<I, A> UnwindSafe for Message<I, A>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
Source§impl<T> Decodable for Twhere
T: Transformable,
impl<T> Decodable for Twhere
T: Transformable,
Source§type Error = <T as Transformable>::Error
type Error = <T as Transformable>::Error
Source§fn decode(src: &[u8]) -> Result<(usize, T), <T as Decodable>::Error>
fn decode(src: &[u8]) -> Result<(usize, T), <T as Decodable>::Error>
Source§impl<T> Encodable for Twhere
T: Transformable,
impl<T> Encodable for Twhere
T: Transformable,
Source§type Error = <T as Transformable>::Error
type Error = <T as Transformable>::Error
Source§fn encode(&self, dst: &mut [u8]) -> Result<usize, <T as Encodable>::Error>
fn encode(&self, dst: &mut [u8]) -> Result<usize, <T as Encodable>::Error>
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode_to_vec(&self) -> Result<Vec<u8>, <T as Encodable>::Error>
fn encode_to_vec(&self) -> Result<Vec<u8>, <T as Encodable>::Error>
alloc or std only.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
Source§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.