pub enum MessageRef<'a, I, A> {
Ping(Ping<I, A>),
IndirectPing(IndirectPing<I, A>),
Ack(AckRef<'a>),
Suspect(Suspect<I>),
Alive(AliveRef<'a, I, A>),
Dead(Dead<I>),
PushPull(PushPullRef<'a, I, A>),
UserData(&'a [u8]),
Nack(Nack),
ErrorResponse(ErrorResponseRef<'a>),
}Expand description
The reference type of the Message enum.
Variants§
Ping(Ping<I, A>)
Ping message
IndirectPing(IndirectPing<I, A>)
Indirect ping message
Ack(AckRef<'a>)
Ack response message
Suspect(Suspect<I>)
Suspect message
Alive(AliveRef<'a, I, A>)
Alive message
Dead(Dead<I>)
Dead message
PushPull(PushPullRef<'a, I, A>)
PushPull message
UserData(&'a [u8])
User mesg, not handled by us
Nack(Nack)
Nack response message
ErrorResponse(ErrorResponseRef<'a>)
Error response message
Implementations§
Source§impl<I, A> MessageRef<'_, I, A>
impl<I, A> MessageRef<'_, I, A>
Sourcepub const fn ty(&self) -> MessageType
pub const fn ty(&self) -> MessageType
Returns the type of the message.
Source§impl<'a, I, A> MessageRef<'a, I, A>
impl<'a, I, A> MessageRef<'a, 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<'a, I, A> MessageRef<'a, I, A>
impl<'a, I, A> MessageRef<'a, I, A>
Sourcepub fn unwrap_ping(self) -> Ping<I, A>
pub fn unwrap_ping(self) -> Ping<I, A>
Unwraps this value to the MessageRef::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 MessageRef::IndirectPing variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_ack(self) -> AckRef<'a>
pub fn unwrap_ack(self) -> AckRef<'a>
Unwraps this value to the MessageRef::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 MessageRef::Suspect variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_alive(self) -> AliveRef<'a, I, A>
pub fn unwrap_alive(self) -> AliveRef<'a, I, A>
Unwraps this value to the MessageRef::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 MessageRef::Dead variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_push_pull(self) -> PushPullRef<'a, I, A>
pub fn unwrap_push_pull(self) -> PushPullRef<'a, I, A>
Unwraps this value to the MessageRef::PushPull variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_user_data(self) -> &'a [u8] ⓘ
pub fn unwrap_user_data(self) -> &'a [u8] ⓘ
Unwraps this value to the MessageRef::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 MessageRef::Nack variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_error_response(self) -> ErrorResponseRef<'a>
pub fn unwrap_error_response(self) -> ErrorResponseRef<'a>
Unwraps this value to the MessageRef::ErrorResponse variant.
Panics if this value is of any other type.
Source§impl<'a, I, A> MessageRef<'a, I, A>
impl<'a, I, A> MessageRef<'a, I, A>
Sourcepub fn try_unwrap_ping(
self,
) -> Result<Ping<I, A>, TryUnwrapError<MessageRef<'a, I, A>>>
pub fn try_unwrap_ping( self, ) -> Result<Ping<I, A>, TryUnwrapError<MessageRef<'a, I, A>>>
Attempts to unwrap this value to the MessageRef::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<MessageRef<'a, I, A>>>
pub fn try_unwrap_indirect_ping( self, ) -> Result<IndirectPing<I, A>, TryUnwrapError<MessageRef<'a, I, A>>>
Attempts to unwrap this value to the MessageRef::IndirectPing variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_ack(
self,
) -> Result<AckRef<'a>, TryUnwrapError<MessageRef<'a, I, A>>>
pub fn try_unwrap_ack( self, ) -> Result<AckRef<'a>, TryUnwrapError<MessageRef<'a, I, A>>>
Attempts to unwrap this value to the MessageRef::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<MessageRef<'a, I, A>>>
pub fn try_unwrap_suspect( self, ) -> Result<Suspect<I>, TryUnwrapError<MessageRef<'a, I, A>>>
Attempts to unwrap this value to the MessageRef::Suspect variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_alive(
self,
) -> Result<AliveRef<'a, I, A>, TryUnwrapError<MessageRef<'a, I, A>>>
pub fn try_unwrap_alive( self, ) -> Result<AliveRef<'a, I, A>, TryUnwrapError<MessageRef<'a, I, A>>>
Attempts to unwrap this value to the MessageRef::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<MessageRef<'a, I, A>>>
pub fn try_unwrap_dead( self, ) -> Result<Dead<I>, TryUnwrapError<MessageRef<'a, I, A>>>
Attempts to unwrap this value to the MessageRef::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<PushPullRef<'a, I, A>, TryUnwrapError<MessageRef<'a, I, A>>>
pub fn try_unwrap_push_pull( self, ) -> Result<PushPullRef<'a, I, A>, TryUnwrapError<MessageRef<'a, I, A>>>
Attempts to unwrap this value to the MessageRef::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<&'a [u8], TryUnwrapError<MessageRef<'a, I, A>>>
pub fn try_unwrap_user_data( self, ) -> Result<&'a [u8], TryUnwrapError<MessageRef<'a, I, A>>>
Attempts to unwrap this value to the MessageRef::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<MessageRef<'a, I, A>>>
pub fn try_unwrap_nack( self, ) -> Result<Nack, TryUnwrapError<MessageRef<'a, I, A>>>
Attempts to unwrap this value to the MessageRef::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<ErrorResponseRef<'a>, TryUnwrapError<MessageRef<'a, I, A>>>
pub fn try_unwrap_error_response( self, ) -> Result<ErrorResponseRef<'a>, TryUnwrapError<MessageRef<'a, I, A>>>
Attempts to unwrap this value to the MessageRef::ErrorResponse variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Trait Implementations§
Source§impl<'a, I, A> Clone for MessageRef<'a, I, A>
impl<'a, I, A> Clone for MessageRef<'a, I, A>
Source§fn clone(&self) -> MessageRef<'a, I, A>
fn clone(&self) -> MessageRef<'a, I, A>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<'a, I, A> Copy for MessageRef<'a, I, A>
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,
Source§impl<'a, I, A> Debug for MessageRef<'a, I, A>
impl<'a, I, A> Debug for MessageRef<'a, I, A>
Source§impl<'a, I, A> From<&'a [u8]> for MessageRef<'a, I, A>
impl<'a, I, A> From<&'a [u8]> for MessageRef<'a, I, A>
Source§fn from(value: &'a [u8]) -> MessageRef<'a, I, A>
fn from(value: &'a [u8]) -> MessageRef<'a, I, A>
Source§impl<'a, I, A> From<AckRef<'a>> for MessageRef<'a, I, A>
impl<'a, I, A> From<AckRef<'a>> for MessageRef<'a, I, A>
Source§fn from(value: AckRef<'a>) -> MessageRef<'a, I, A>
fn from(value: AckRef<'a>) -> MessageRef<'a, I, A>
Source§impl<'a, I, A> From<AliveRef<'a, I, A>> for MessageRef<'a, I, A>
impl<'a, I, A> From<AliveRef<'a, I, A>> for MessageRef<'a, I, A>
Source§fn from(value: AliveRef<'a, I, A>) -> MessageRef<'a, I, A>
fn from(value: AliveRef<'a, I, A>) -> MessageRef<'a, I, A>
Source§impl<'a, I, A> From<Dead<I>> for MessageRef<'a, I, A>
impl<'a, I, A> From<Dead<I>> for MessageRef<'a, I, A>
Source§fn from(value: Dead<I>) -> MessageRef<'a, I, A>
fn from(value: Dead<I>) -> MessageRef<'a, I, A>
Source§impl<'a, I, A> From<ErrorResponseRef<'a>> for MessageRef<'a, I, A>
impl<'a, I, A> From<ErrorResponseRef<'a>> for MessageRef<'a, I, A>
Source§fn from(value: ErrorResponseRef<'a>) -> MessageRef<'a, I, A>
fn from(value: ErrorResponseRef<'a>) -> MessageRef<'a, I, A>
Source§impl<'a, I, A> From<IndirectPing<I, A>> for MessageRef<'a, I, A>
impl<'a, I, A> From<IndirectPing<I, A>> for MessageRef<'a, I, A>
Source§fn from(value: IndirectPing<I, A>) -> MessageRef<'a, I, A>
fn from(value: IndirectPing<I, A>) -> MessageRef<'a, I, A>
Source§impl<'a, I, A> From<Nack> for MessageRef<'a, I, A>
impl<'a, I, A> From<Nack> for MessageRef<'a, I, A>
Source§fn from(value: Nack) -> MessageRef<'a, I, A>
fn from(value: Nack) -> MessageRef<'a, I, A>
Source§impl<'a, I, A> From<Ping<I, A>> for MessageRef<'a, I, A>
impl<'a, I, A> From<Ping<I, A>> for MessageRef<'a, I, A>
Source§fn from(value: Ping<I, A>) -> MessageRef<'a, I, A>
fn from(value: Ping<I, A>) -> MessageRef<'a, I, A>
Source§impl<'a, I, A> From<PushPullRef<'a, I, A>> for MessageRef<'a, I, A>
impl<'a, I, A> From<PushPullRef<'a, I, A>> for MessageRef<'a, I, A>
Source§fn from(value: PushPullRef<'a, I, A>) -> MessageRef<'a, I, A>
fn from(value: PushPullRef<'a, I, A>) -> MessageRef<'a, I, A>
Source§impl<'a, I, A> From<Suspect<I>> for MessageRef<'a, I, A>
impl<'a, I, A> From<Suspect<I>> for MessageRef<'a, I, A>
Source§fn from(value: Suspect<I>) -> MessageRef<'a, I, A>
fn from(value: Suspect<I>) -> MessageRef<'a, I, A>
Auto Trait Implementations§
impl<'a, I, A> Freeze for MessageRef<'a, I, A>
impl<'a, I, A> RefUnwindSafe for MessageRef<'a, I, A>where
I: RefUnwindSafe,
A: RefUnwindSafe,
impl<'a, I, A> Send for MessageRef<'a, I, A>
impl<'a, I, A> Sync for MessageRef<'a, I, A>
impl<'a, I, A> Unpin for MessageRef<'a, I, A>
impl<'a, I, A> UnsafeUnpin for MessageRef<'a, I, A>where
I: UnsafeUnpin,
A: UnsafeUnpin,
impl<'a, I, A> UnwindSafe for MessageRef<'a, I, A>where
I: UnwindSafe,
A: UnwindSafe,
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> 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