pub trait HostMessage: Send {
// Required methods
fn new(
&mut self,
data: Vec<u8>,
) -> impl Future<Output = Result<Resource<Message>>> + Send;
fn topic(
&mut self,
self_: Resource<Message>,
) -> impl Future<Output = Result<Option<Topic>>> + Send;
fn content_type(
&mut self,
self_: Resource<Message>,
) -> impl Future<Output = Result<Option<String>>> + Send;
fn set_content_type(
&mut self,
self_: Resource<Message>,
content_type: String,
) -> impl Future<Output = Result<()>> + Send;
fn data(
&mut self,
self_: Resource<Message>,
) -> impl Future<Output = Result<Vec<u8>>> + Send;
fn set_data(
&mut self,
self_: Resource<Message>,
data: Vec<u8>,
) -> impl Future<Output = Result<()>> + Send;
fn metadata(
&mut self,
self_: Resource<Message>,
) -> impl Future<Output = Result<Option<Metadata>>> + Send;
fn add_metadata(
&mut self,
self_: Resource<Message>,
key: String,
value: String,
) -> impl Future<Output = Result<()>> + Send;
fn set_metadata(
&mut self,
self_: Resource<Message>,
meta: Metadata,
) -> impl Future<Output = Result<()>> + Send;
fn remove_metadata(
&mut self,
self_: Resource<Message>,
key: String,
) -> impl Future<Output = Result<()>> + Send;
fn drop(
&mut self,
rep: Resource<Message>,
) -> impl Future<Output = Result<()>> + Send;
}Required Methods§
fn new( &mut self, data: Vec<u8>, ) -> impl Future<Output = Result<Resource<Message>>> + Send
Sourcefn topic(
&mut self,
self_: Resource<Message>,
) -> impl Future<Output = Result<Option<Topic>>> + Send
fn topic( &mut self, self_: Resource<Message>, ) -> impl Future<Output = Result<Option<Topic>>> + Send
The topic/subject/channel this message was received on, if any
Sourcefn content_type(
&mut self,
self_: Resource<Message>,
) -> impl Future<Output = Result<Option<String>>> + Send
fn content_type( &mut self, self_: Resource<Message>, ) -> impl Future<Output = Result<Option<String>>> + Send
An optional content-type describing the format of the data in the message. This is sometimes described as the “format” type
Sourcefn set_content_type(
&mut self,
self_: Resource<Message>,
content_type: String,
) -> impl Future<Output = Result<()>> + Send
fn set_content_type( &mut self, self_: Resource<Message>, content_type: String, ) -> impl Future<Output = Result<()>> + Send
Set the content-type describing the format of the data in the message. This is sometimes described as the “format” type
Sourcefn data(
&mut self,
self_: Resource<Message>,
) -> impl Future<Output = Result<Vec<u8>>> + Send
fn data( &mut self, self_: Resource<Message>, ) -> impl Future<Output = Result<Vec<u8>>> + Send
An opaque blob of data
Sourcefn set_data(
&mut self,
self_: Resource<Message>,
data: Vec<u8>,
) -> impl Future<Output = Result<()>> + Send
fn set_data( &mut self, self_: Resource<Message>, data: Vec<u8>, ) -> impl Future<Output = Result<()>> + Send
Set the opaque blob of data for this message, discarding the old value
Sourcefn metadata(
&mut self,
self_: Resource<Message>,
) -> impl Future<Output = Result<Option<Metadata>>> + Send
fn metadata( &mut self, self_: Resource<Message>, ) -> impl Future<Output = Result<Option<Metadata>>> + Send
Optional metadata (also called headers or attributes in some systems) attached to the message. This metadata is simply decoration and should not be interpreted by a host to ensure portability across different implementors (e.g., Kafka -> NATS, etc.).
Sourcefn add_metadata(
&mut self,
self_: Resource<Message>,
key: String,
value: String,
) -> impl Future<Output = Result<()>> + Send
fn add_metadata( &mut self, self_: Resource<Message>, key: String, value: String, ) -> impl Future<Output = Result<()>> + Send
Add a new key-value pair to the metadata, overwriting any existing value for the same key
Sourcefn set_metadata(
&mut self,
self_: Resource<Message>,
meta: Metadata,
) -> impl Future<Output = Result<()>> + Send
fn set_metadata( &mut self, self_: Resource<Message>, meta: Metadata, ) -> impl Future<Output = Result<()>> + Send
Set the metadata
Sourcefn remove_metadata(
&mut self,
self_: Resource<Message>,
key: String,
) -> impl Future<Output = Result<()>> + Send
fn remove_metadata( &mut self, self_: Resource<Message>, key: String, ) -> impl Future<Output = Result<()>> + Send
Remove a key-value pair from the metadata
fn drop( &mut self, rep: Resource<Message>, ) -> impl Future<Output = Result<()>> + Send
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<_T: HostMessage + ?Sized + Send> HostMessage for &mut _T
impl<_T: HostMessage + ?Sized + Send> HostMessage for &mut _T
Source§fn topic(
&mut self,
self_: Resource<Message>,
) -> impl Future<Output = Result<Option<Topic>>> + Send
fn topic( &mut self, self_: Resource<Message>, ) -> impl Future<Output = Result<Option<Topic>>> + Send
The topic/subject/channel this message was received on, if any
Source§fn content_type(
&mut self,
self_: Resource<Message>,
) -> impl Future<Output = Result<Option<String>>> + Send
fn content_type( &mut self, self_: Resource<Message>, ) -> impl Future<Output = Result<Option<String>>> + Send
An optional content-type describing the format of the data in the message. This is sometimes described as the “format” type
Source§fn set_content_type(
&mut self,
self_: Resource<Message>,
content_type: String,
) -> impl Future<Output = Result<()>> + Send
fn set_content_type( &mut self, self_: Resource<Message>, content_type: String, ) -> impl Future<Output = Result<()>> + Send
Set the content-type describing the format of the data in the message. This is sometimes described as the “format” type
Source§fn data(
&mut self,
self_: Resource<Message>,
) -> impl Future<Output = Result<Vec<u8>>> + Send
fn data( &mut self, self_: Resource<Message>, ) -> impl Future<Output = Result<Vec<u8>>> + Send
An opaque blob of data
Source§fn set_data(
&mut self,
self_: Resource<Message>,
data: Vec<u8>,
) -> impl Future<Output = Result<()>> + Send
fn set_data( &mut self, self_: Resource<Message>, data: Vec<u8>, ) -> impl Future<Output = Result<()>> + Send
Set the opaque blob of data for this message, discarding the old value
Source§fn metadata(
&mut self,
self_: Resource<Message>,
) -> impl Future<Output = Result<Option<Metadata>>> + Send
fn metadata( &mut self, self_: Resource<Message>, ) -> impl Future<Output = Result<Option<Metadata>>> + Send
Optional metadata (also called headers or attributes in some systems) attached to the message. This metadata is simply decoration and should not be interpreted by a host to ensure portability across different implementors (e.g., Kafka -> NATS, etc.).
Source§fn add_metadata(
&mut self,
self_: Resource<Message>,
key: String,
value: String,
) -> impl Future<Output = Result<()>> + Send
fn add_metadata( &mut self, self_: Resource<Message>, key: String, value: String, ) -> impl Future<Output = Result<()>> + Send
Add a new key-value pair to the metadata, overwriting any existing value for the same key
Source§fn set_metadata(
&mut self,
self_: Resource<Message>,
meta: Metadata,
) -> impl Future<Output = Result<()>> + Send
fn set_metadata( &mut self, self_: Resource<Message>, meta: Metadata, ) -> impl Future<Output = Result<()>> + Send
Set the metadata
Source§fn remove_metadata(
&mut self,
self_: Resource<Message>,
key: String,
) -> impl Future<Output = Result<()>> + Send
fn remove_metadata( &mut self, self_: Resource<Message>, key: String, ) -> impl Future<Output = Result<()>> + Send
Remove a key-value pair from the metadata