pub struct ProtoMessage {
pub metadata: HashMap<String, String>,
pub message_type: Option<MessageType>,
}Fields§
§metadata: HashMap<String, String>§message_type: Option<MessageType>Implementations§
Source§impl ProtoMessage
ProtoMessage
This represents a generic message that can be sent over the network
impl ProtoMessage
ProtoMessage This represents a generic message that can be sent over the network
pub fn new_subscribe( source: &Name, dst: &Name, flags: Option<SlimHeaderFlags>, ) -> Self
pub fn new_unsubscribe( source: &Name, dst: &Name, flags: Option<SlimHeaderFlags>, ) -> Self
pub fn new_publish( source: &Name, dst: &Name, flags: Option<SlimHeaderFlags>, content_type: &str, blob: Vec<u8>, ) -> Self
pub fn new_publish_with_headers( slim_header: Option<SlimHeader>, session_header: Option<SessionHeader>, content_type: &str, blob: Vec<u8>, ) -> Self
pub fn validate(&self) -> Result<(), MessageError>
pub fn insert_metadata(&mut self, key: String, val: String)
pub fn remove_metadata(&mut self, key: &str) -> Option<String>
pub fn contains_metadata(&self, key: &str) -> bool
pub fn get_metadata(&self, key: &str) -> Option<&String>
pub fn get_metadata_map(&self) -> HashMap<String, String>
pub fn set_metadata_map(&mut self, map: HashMap<String, String>)
pub fn get_slim_header(&self) -> &SlimHeader
pub fn get_slim_header_mut(&mut self) -> &mut SlimHeader
pub fn try_get_slim_header(&self) -> Option<&SlimHeader>
pub fn get_session_header(&self) -> &SessionHeader
pub fn get_session_header_mut(&mut self) -> &mut SessionHeader
pub fn try_get_session_header(&self) -> Option<&SessionHeader>
pub fn try_get_session_header_mut(&mut self) -> Option<&mut SessionHeader>
pub fn get_id(&self) -> u32
pub fn get_source(&self) -> Name
pub fn get_fanout(&self) -> u32
pub fn get_recv_from(&self) -> Option<u64>
pub fn get_forward_to(&self) -> Option<u64>
pub fn get_error(&self) -> Option<bool>
pub fn get_incoming_conn(&self) -> u64
pub fn try_get_incoming_conn(&self) -> Option<u64>
pub fn get_dst(&self) -> Name
pub fn get_type(&self) -> &MessageType
pub fn get_payload(&self) -> Option<&Content>
pub fn get_session_message_type(&self) -> SessionMessageType
pub fn clear_slim_header(&mut self)
pub fn set_recv_from(&mut self, recv_from: Option<u64>)
pub fn set_forward_to(&mut self, forward_to: Option<u64>)
pub fn set_error(&mut self, error: Option<bool>)
pub fn set_fanout(&mut self, fanout: u32)
pub fn set_incoming_conn(&mut self, incoming_conn: Option<u64>)
pub fn set_error_flag(&mut self, error: Option<bool>)
pub fn set_session_message_type(&mut self, message_type: SessionMessageType)
pub fn set_session_type(&mut self, session_type: ProtoSessionType)
pub fn get_session_type(&self) -> ProtoSessionType
pub fn set_message_id(&mut self, message_id: u32)
pub fn is_publish(&self) -> bool
pub fn is_subscribe(&self) -> bool
pub fn is_unsubscribe(&self) -> bool
Trait Implementations§
Source§impl AsRef<Publish> for ProtoMessage
impl AsRef<Publish> for ProtoMessage
Source§fn as_ref(&self) -> &ProtoPublish
fn as_ref(&self) -> &ProtoPublish
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl From<Message> for ProtoPublish
From ProtoMessage to ProtoPublish
impl From<Message> for ProtoPublish
From ProtoMessage to ProtoPublish
Source§fn from(message: ProtoMessage) -> Self
fn from(message: ProtoMessage) -> Self
Converts to this type from the input type.
Source§impl From<Message> for ProtoSubscribe
From ProtoMessage to ProtoSubscribe
impl From<Message> for ProtoSubscribe
From ProtoMessage to ProtoSubscribe
Source§fn from(message: ProtoMessage) -> Self
fn from(message: ProtoMessage) -> Self
Converts to this type from the input type.
Source§impl From<Message> for ProtoUnsubscribe
From ProtoMessage to ProtoUnsubscribe
impl From<Message> for ProtoUnsubscribe
From ProtoMessage to ProtoUnsubscribe
Source§fn from(message: ProtoMessage) -> Self
fn from(message: ProtoMessage) -> Self
Converts to this type from the input type.
Source§impl Message for Message
impl Message for Message
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message to a buffer. Read more
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message to a newly allocated buffer.
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message with a length-delimiter to a buffer. Read more
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message with a length-delimiter to a newly allocated buffer.
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes an instance of the message from a buffer. Read more
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes a length-delimited instance of the message from the buffer.
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes an instance of the message from a buffer, and merges it into
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes a length-delimited instance of the message from buffer, and
merges it into
self.impl StructuralPartialEq for Message
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request