pub struct RoutingMessage {
pub id: u64,
pub topic: MessageTopic,
pub payload_size: usize,
pub sender: String,
pub timestamp: u64,
pub ttl: u8,
pub priority: u8,
}Expand description
A message travelling through SubscriptionRouter.
The id field is computed as the FNV-1a hash of sender + topic.0 + timestamp.to_string() at construction time.
Fields§
§id: u64FNV-1a hash of (sender + topic + timestamp).
topic: MessageTopicTopic this message belongs to.
payload_size: usizeNumber of bytes in the logical payload.
sender: StringOriginating peer identifier.
timestamp: u64Wall-clock millisecond timestamp at which the message was created.
ttl: u8Remaining hops; the router drops messages where ttl == 0 before
delivering them.
priority: u8Priority: 0 = lowest, 255 = highest.
Implementations§
Source§impl RoutingMessage
impl RoutingMessage
Sourcepub fn new(
topic: MessageTopic,
payload_size: usize,
sender: impl Into<String>,
timestamp: u64,
ttl: u8,
priority: u8,
) -> Self
pub fn new( topic: MessageTopic, payload_size: usize, sender: impl Into<String>, timestamp: u64, ttl: u8, priority: u8, ) -> Self
Create a new RoutingMessage, computing its id automatically.
Trait Implementations§
Source§impl Clone for RoutingMessage
impl Clone for RoutingMessage
Source§fn clone(&self) -> RoutingMessage
fn clone(&self) -> RoutingMessage
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 moreAuto Trait Implementations§
impl Freeze for RoutingMessage
impl RefUnwindSafe for RoutingMessage
impl Send for RoutingMessage
impl Sync for RoutingMessage
impl Unpin for RoutingMessage
impl UnsafeUnpin for RoutingMessage
impl UnwindSafe for RoutingMessage
Blanket Implementations§
impl<T> Allocation for T
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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>
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 more