Skip to main content

MessageRef

Enum MessageRef 

Source
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>

Source

pub const fn ty(&self) -> MessageType

Returns the type of the message.

Source§

impl<'a, I, A> MessageRef<'a, I, A>

Source

pub const fn is_ping(&self) -> bool

Returns true if this value is of type Ping. Returns false otherwise

Source

pub const fn is_indirect_ping(&self) -> bool

Returns true if this value is of type IndirectPing. Returns false otherwise

Source

pub const fn is_ack(&self) -> bool

Returns true if this value is of type Ack. Returns false otherwise

Source

pub const fn is_suspect(&self) -> bool

Returns true if this value is of type Suspect. Returns false otherwise

Source

pub const fn is_alive(&self) -> bool

Returns true if this value is of type Alive. Returns false otherwise

Source

pub const fn is_dead(&self) -> bool

Returns true if this value is of type Dead. Returns false otherwise

Source

pub const fn is_push_pull(&self) -> bool

Returns true if this value is of type PushPull. Returns false otherwise

Source

pub const fn is_user_data(&self) -> bool

Returns true if this value is of type UserData. Returns false otherwise

Source

pub const fn is_nack(&self) -> bool

Returns true if this value is of type Nack. Returns false otherwise

Source

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>

Source

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.

Source

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.

Source

pub fn unwrap_ack(self) -> AckRef<'a>

Unwraps this value to the MessageRef::Ack variant. Panics if this value is of any other type.

Source

pub fn unwrap_suspect(self) -> Suspect<I>

Unwraps this value to the MessageRef::Suspect variant. Panics if this value is of any other type.

Source

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.

Source

pub fn unwrap_dead(self) -> Dead<I>

Unwraps this value to the MessageRef::Dead variant. Panics if this value is of any other type.

Source

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.

Source

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.

Source

pub fn unwrap_nack(self) -> Nack

Unwraps this value to the MessageRef::Nack variant. Panics if this value is of any other type.

Source

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>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>
where I: Clone, A: Clone,

Source§

fn clone(&self) -> MessageRef<'a, I, A>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, I, A> Copy for MessageRef<'a, I, A>
where I: Copy, A: Copy,

Source§

impl<'a, I, A> DataRef<'a, Message<I, A>> for MessageRef<'a, <I as Data>::Ref<'a>, <A as Data>::Ref<'a>>
where I: Data, A: Data,

Source§

fn decode( src: &'a [u8], ) -> Result<(usize, MessageRef<'a, <I as Data>::Ref<'a>, <A as Data>::Ref<'a>>), DecodeError>
where MessageRef<'a, <I as Data>::Ref<'a>, <A as Data>::Ref<'a>>: Sized,

Decodes the reference type from a buffer. Read more
Source§

fn decode_length_delimited(src: &'a [u8]) -> Result<(usize, Self), DecodeError>
where Self: Sized,

Decodes a length-delimited reference instance of the message from the buffer.
Source§

impl<'a, I, A> Debug for MessageRef<'a, I, A>
where I: Debug, A: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a, I, A> From<&'a [u8]> for MessageRef<'a, I, A>

Source§

fn from(value: &'a [u8]) -> MessageRef<'a, I, A>

Converts to this type from the input type.
Source§

impl<'a, I, A> From<AckRef<'a>> for MessageRef<'a, I, A>

Source§

fn from(value: AckRef<'a>) -> MessageRef<'a, I, A>

Converts to this type from the input type.
Source§

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>

Converts to this type from the input type.
Source§

impl<'a, I, A> From<Dead<I>> for MessageRef<'a, I, A>

Source§

fn from(value: Dead<I>) -> MessageRef<'a, I, A>

Converts to this type from the input type.
Source§

impl<'a, I, A> From<ErrorResponseRef<'a>> for MessageRef<'a, I, A>

Source§

fn from(value: ErrorResponseRef<'a>) -> MessageRef<'a, I, A>

Converts to this type from the input type.
Source§

impl<'a, I, A> From<IndirectPing<I, A>> for MessageRef<'a, I, A>

Source§

fn from(value: IndirectPing<I, A>) -> MessageRef<'a, I, A>

Converts to this type from the input type.
Source§

impl<'a, I, A> From<Nack> for MessageRef<'a, I, A>

Source§

fn from(value: Nack) -> MessageRef<'a, I, A>

Converts to this type from the input type.
Source§

impl<'a, I, A> From<Ping<I, A>> for MessageRef<'a, I, A>

Source§

fn from(value: Ping<I, A>) -> MessageRef<'a, I, A>

Converts to this type from the input type.
Source§

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>

Converts to this type from the input type.
Source§

impl<'a, I, A> From<Suspect<I>> for MessageRef<'a, I, A>

Source§

fn from(value: Suspect<I>) -> MessageRef<'a, I, A>

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a, I, A> Freeze for MessageRef<'a, I, A>
where I: Freeze, A: Freeze,

§

impl<'a, I, A> RefUnwindSafe for MessageRef<'a, I, A>

§

impl<'a, I, A> Send for MessageRef<'a, I, A>
where I: Send, A: Send,

§

impl<'a, I, A> Sync for MessageRef<'a, I, A>
where I: Sync, A: Sync,

§

impl<'a, I, A> Unpin for MessageRef<'a, I, A>
where I: Unpin, A: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more