pub struct MessageMeta {
pub proto_id: u16,
pub proto_opcode: u8,
pub reliable: bool,
}Expand description
Meta-data when sending/receving messages via an Exchange. Basically, the protocol ID, the protocol opcode and whether the message should be set in a reliable manner.
Fields§
§proto_id: u16§proto_opcode: u8§reliable: boolImplementations§
Source§impl MessageMeta
impl MessageMeta
pub const fn new(proto_id: u16, proto_opcode: u8, reliable: bool) -> MessageMeta
Sourcepub fn opcode<T>(&self) -> Result<T, Error>where
T: FromPrimitive,
pub fn opcode<T>(&self) -> Result<T, Error>where
T: FromPrimitive,
Try to cast the protocol opcode to a specific type
Sourcepub fn check_opcode<T>(&self, opcode: T) -> Result<(), Error>where
T: FromPrimitive + PartialEq,
pub fn check_opcode<T>(&self, opcode: T) -> Result<(), Error>where
T: FromPrimitive + PartialEq,
Check if the protocol opcode is equal to a specific value
Sourcepub fn from(proto: &ProtoHdr) -> MessageMeta
pub fn from(proto: &ProtoHdr) -> MessageMeta
Create an instance from a ProtoHdr instance
Sourcepub fn set_into(&self, proto: &mut ProtoHdr)
pub fn set_into(&self, proto: &mut ProtoHdr)
Set the protocol ID and opcode into a ProtoHdr instance
pub fn reliable(self, reliable: bool) -> MessageMeta
Trait Implementations§
Source§impl Clone for MessageMeta
impl Clone for MessageMeta
Source§fn clone(&self) -> MessageMeta
fn clone(&self) -> MessageMeta
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for MessageMeta
Source§impl Debug for MessageMeta
impl Debug for MessageMeta
Source§impl Display for MessageMeta
impl Display for MessageMeta
impl Eq for MessageMeta
Source§impl From<OpCode> for MessageMeta
impl From<OpCode> for MessageMeta
Source§fn from(op: OpCode) -> MessageMeta
fn from(op: OpCode) -> MessageMeta
Converts to this type from the input type.
Source§impl From<OpCode> for MessageMeta
impl From<OpCode> for MessageMeta
Source§fn from(opcode: OpCode) -> MessageMeta
fn from(opcode: OpCode) -> MessageMeta
Converts to this type from the input type.
Source§impl From<OpCode> for MessageMeta
impl From<OpCode> for MessageMeta
Source§fn from(op: OpCode) -> MessageMeta
fn from(op: OpCode) -> MessageMeta
Converts to this type from the input type.
Source§impl PartialEq for MessageMeta
impl PartialEq for MessageMeta
Source§fn eq(&self, other: &MessageMeta) -> bool
fn eq(&self, other: &MessageMeta) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for MessageMeta
Auto Trait Implementations§
impl Freeze for MessageMeta
impl RefUnwindSafe for MessageMeta
impl Send for MessageMeta
impl Sync for MessageMeta
impl Unpin for MessageMeta
impl UnsafeUnpin for MessageMeta
impl UnwindSafe for MessageMeta
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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 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> ⓘ
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 moreSource§impl<T, I> IntoFallibleInit<T> for Iwhere
I: Init<T>,
impl<T, I> IntoFallibleInit<T> for Iwhere
I: Init<T>,
Source§fn into_fallible<E>(self) -> impl Init<T, E>
fn into_fallible<E>(self) -> impl Init<T, E>
Convert the infallible initializer to a fallible one.
Source§impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
Source§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
Performs the conversion.
Source§fn octets_into(self) -> Target
fn octets_into(self) -> Target
Performs an infallible conversion.