#[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 fn is_ping(&self) -> bool
pub const fn is_ping(&self) -> bool
Returns true if this value is of type Ping. Returns false otherwise
Sourcepub const fn is_indirect_ping(&self) -> bool
pub const fn is_indirect_ping(&self) -> bool
Returns true if this value is of type IndirectPing. Returns false otherwise
Sourcepub const fn is_ack(&self) -> bool
pub const fn is_ack(&self) -> bool
Returns true if this value is of type Ack. Returns false otherwise
Sourcepub const fn is_suspect(&self) -> bool
pub const fn is_suspect(&self) -> bool
Returns true if this value is of type Suspect. Returns false otherwise
Sourcepub const fn is_alive(&self) -> bool
pub const fn is_alive(&self) -> bool
Returns true if this value is of type Alive. Returns false otherwise
Sourcepub const fn is_dead(&self) -> bool
pub const fn is_dead(&self) -> bool
Returns true if this value is of type Dead. Returns false otherwise
Sourcepub const fn is_push_pull(&self) -> bool
pub const fn is_push_pull(&self) -> bool
Returns true if this value is of type PushPull. Returns false otherwise
Sourcepub const fn is_user_data(&self) -> bool
pub const fn is_user_data(&self) -> bool
Returns true if this value is of type UserData. Returns false otherwise
Sourcepub const fn is_nack(&self) -> bool
pub const fn is_nack(&self) -> bool
Returns true if this value is of type Nack. Returns false otherwise
Sourcepub const fn is_error_response(&self) -> bool
pub const fn is_error_response(&self) -> bool
Returns true if this value is of type ErrorResponse. Returns false otherwise
Source§impl<I, A> Message<I, A>
impl<I, A> Message<I, A>
Sourcepub fn unwrap_ping(self) -> Ping<I, A>
pub fn unwrap_ping(self) -> Ping<I, A>
Unwraps this value to the Message::Ping variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_indirect_ping(self) -> IndirectPing<I, A>
pub fn unwrap_indirect_ping(self) -> IndirectPing<I, A>
Unwraps this value to the Message::IndirectPing variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_ack(self) -> Ack
pub fn unwrap_ack(self) -> Ack
Unwraps this value to the Message::Ack variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_suspect(self) -> Suspect<I>
pub fn unwrap_suspect(self) -> Suspect<I>
Unwraps this value to the Message::Suspect variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_alive(self) -> Alive<I, A>
pub fn unwrap_alive(self) -> Alive<I, A>
Unwraps this value to the Message::Alive variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_dead(self) -> Dead<I>
pub fn unwrap_dead(self) -> Dead<I>
Unwraps this value to the Message::Dead variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_push_pull(self) -> PushPull<I, A>
pub fn unwrap_push_pull(self) -> PushPull<I, A>
Unwraps this value to the Message::PushPull variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_user_data(self) -> Bytes
pub fn unwrap_user_data(self) -> Bytes
Unwraps this value to the Message::UserData variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_nack(self) -> Nack
pub fn unwrap_nack(self) -> Nack
Unwraps this value to the Message::Nack variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_error_response(self) -> ErrorResponse
pub fn unwrap_error_response(self) -> ErrorResponse
Unwraps this value to the Message::ErrorResponse variant.
Panics if this value is of any other type.
Source§impl<I, A> Message<I, A>
impl<I, A> Message<I, A>
Sourcepub fn try_unwrap_ping(
self,
) -> Result<Ping<I, A>, TryUnwrapError<Message<I, A>>>
pub fn try_unwrap_ping( self, ) -> Result<Ping<I, A>, TryUnwrapError<Message<I, A>>>
Attempts to unwrap this value to the Message::Ping variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_indirect_ping(
self,
) -> Result<IndirectPing<I, A>, TryUnwrapError<Message<I, A>>>
pub fn try_unwrap_indirect_ping( self, ) -> Result<IndirectPing<I, A>, TryUnwrapError<Message<I, A>>>
Attempts to unwrap this value to the Message::IndirectPing variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_ack(self) -> Result<Ack, TryUnwrapError<Message<I, A>>>
pub fn try_unwrap_ack(self) -> Result<Ack, TryUnwrapError<Message<I, A>>>
Attempts to unwrap this value to the Message::Ack variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_suspect(
self,
) -> Result<Suspect<I>, TryUnwrapError<Message<I, A>>>
pub fn try_unwrap_suspect( self, ) -> Result<Suspect<I>, TryUnwrapError<Message<I, A>>>
Attempts to unwrap this value to the Message::Suspect variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_alive(
self,
) -> Result<Alive<I, A>, TryUnwrapError<Message<I, A>>>
pub fn try_unwrap_alive( self, ) -> Result<Alive<I, A>, TryUnwrapError<Message<I, A>>>
Attempts to unwrap this value to the Message::Alive variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_dead(self) -> Result<Dead<I>, TryUnwrapError<Message<I, A>>>
pub fn try_unwrap_dead(self) -> Result<Dead<I>, TryUnwrapError<Message<I, A>>>
Attempts to unwrap this value to the Message::Dead variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_push_pull(
self,
) -> Result<PushPull<I, A>, TryUnwrapError<Message<I, A>>>
pub fn try_unwrap_push_pull( self, ) -> Result<PushPull<I, A>, TryUnwrapError<Message<I, A>>>
Attempts to unwrap this value to the Message::PushPull variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_user_data(
self,
) -> Result<Bytes, TryUnwrapError<Message<I, A>>>
pub fn try_unwrap_user_data( self, ) -> Result<Bytes, TryUnwrapError<Message<I, A>>>
Attempts to unwrap this value to the Message::UserData variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_nack(self) -> Result<Nack, TryUnwrapError<Message<I, A>>>
pub fn try_unwrap_nack(self) -> Result<Nack, TryUnwrapError<Message<I, A>>>
Attempts to unwrap this value to the Message::Nack variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_error_response(
self,
) -> Result<ErrorResponse, TryUnwrapError<Message<I, A>>>
pub fn try_unwrap_error_response( self, ) -> Result<ErrorResponse, TryUnwrapError<Message<I, A>>>
Attempts to unwrap this value to the Message::ErrorResponse variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Source§impl<I, A> Message<I, A>
impl<I, A> Message<I, A>
Sourcepub const fn ty(&self) -> MessageType
pub const fn ty(&self) -> MessageType
Returns the type of the message.
Sourcepub const fn indirect_ping(val: IndirectPing<I, A>) -> Message<I, A>
pub const fn indirect_ping(val: IndirectPing<I, A>) -> Message<I, A>
Construct a Message from IndirectPing.
Sourcepub const fn error_response(val: ErrorResponse) -> Message<I, A>
pub const fn error_response(val: ErrorResponse) -> Message<I, A>
Construct a Message from ErrorResponse.
Trait Implementations§
Source§impl<'arbitrary, I, A> Arbitrary<'arbitrary> for Message<I, A>
impl<'arbitrary, I, A> Arbitrary<'arbitrary> for Message<I, A>
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Message<I, A>, Error>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Message<I, A>, Error>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(
u: Unstructured<'arbitrary>,
) -> Result<Message<I, A>, Error>
fn arbitrary_take_rest( u: Unstructured<'arbitrary>, ) -> Result<Message<I, A>, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl<I, A> Data for Message<I, A>
impl<I, A> Data for Message<I, A>
Source§type Ref<'a> = MessageRef<'a, <I as Data>::Ref<'a>, <A as Data>::Ref<'a>>
type Ref<'a> = MessageRef<'a, <I as Data>::Ref<'a>, <A as Data>::Ref<'a>>
Source§fn from_ref(
val: <Message<I, A> as Data>::Ref<'_>,
) -> Result<Message<I, A>, DecodeError>
fn from_ref( val: <Message<I, A> as Data>::Ref<'_>, ) -> Result<Message<I, A>, DecodeError>
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut [u8]) -> Result<usize, EncodeError>
fn encode(&self, buf: &mut [u8]) -> Result<usize, EncodeError>
Source§fn encoded_len_with_length_delimited(&self) -> usize
fn encoded_len_with_length_delimited(&self) -> usize
Source§fn encode_to_vec(&self) -> Result<Vec<u8>, EncodeError>
fn encode_to_vec(&self) -> Result<Vec<u8>, EncodeError>
alloc or std only.Source§fn encode_to_bytes(&self) -> Result<Bytes, EncodeError>
fn encode_to_bytes(&self) -> Result<Bytes, EncodeError>
alloc or std only.Bytes.Source§fn encode_length_delimited(&self, buf: &mut [u8]) -> Result<usize, EncodeError>
fn encode_length_delimited(&self, buf: &mut [u8]) -> Result<usize, EncodeError>
Source§fn encode_length_delimited_to_vec(&self) -> Result<Vec<u8>, EncodeError>
fn encode_length_delimited_to_vec(&self) -> Result<Vec<u8>, EncodeError>
alloc or std only.Source§fn encode_length_delimited_to_bytes(&self) -> Result<Bytes, EncodeError>
fn encode_length_delimited_to_bytes(&self) -> Result<Bytes, EncodeError>
alloc or std only.Bytes.Source§fn decode(src: &[u8]) -> Result<(usize, Self), DecodeError>where
Self: Sized,
fn decode(src: &[u8]) -> Result<(usize, Self), DecodeError>where
Self: Sized,
Source§fn decode_length_delimited(buf: &[u8]) -> Result<(usize, Self), DecodeError>where
Self: Sized,
fn decode_length_delimited(buf: &[u8]) -> Result<(usize, Self), DecodeError>where
Self: Sized,
Source§impl<'a, I, A> DataRef<'a, Message<I, A>> for MessageRef<'a, <I as Data>::Ref<'a>, <A as Data>::Ref<'a>>
impl<'a, I, A> DataRef<'a, Message<I, A>> for MessageRef<'a, <I as Data>::Ref<'a>, <A as Data>::Ref<'a>>
Source§fn decode(
src: &'a [u8],
) -> Result<(usize, MessageRef<'a, <I as Data>::Ref<'a>, <A as Data>::Ref<'a>>), DecodeError>
fn decode( src: &'a [u8], ) -> Result<(usize, MessageRef<'a, <I as Data>::Ref<'a>, <A as Data>::Ref<'a>>), DecodeError>
Source§fn decode_length_delimited(src: &'a [u8]) -> Result<(usize, Self), DecodeError>where
Self: Sized,
fn decode_length_delimited(src: &'a [u8]) -> Result<(usize, Self), DecodeError>where
Self: Sized,
impl<I, A> Eq for Message<I, A>
Source§impl<I, A> From<ErrorResponse> for Message<I, A>
impl<I, A> From<ErrorResponse> for Message<I, A>
Source§fn from(value: ErrorResponse) -> Message<I, A>
fn from(value: ErrorResponse) -> Message<I, A>
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>) -> Message<I, A>
fn from(value: IndirectPing<I, A>) -> Message<I, A>
Source§impl<I, A> PartialEq for Message<I, A>
impl<I, A> PartialEq 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> UnsafeUnpin for Message<I, A>where
I: UnsafeUnpin,
A: UnsafeUnpin,
impl<I, A> UnwindSafe for Message<I, A>
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<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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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