wasmcloud_runtime::capability::messaging::types

Trait HostMessage

source
pub trait HostMessage {
    // Required methods
    fn new<'life0, 'async_trait>(
        &'life0 mut self,
        data: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<Resource<Message>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn topic<'life0, 'async_trait>(
        &'life0 mut self,
        self_: Resource<Message>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Topic>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn content_type<'life0, 'async_trait>(
        &'life0 mut self,
        self_: Resource<Message>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_content_type<'life0, 'async_trait>(
        &'life0 mut self,
        self_: Resource<Message>,
        content_type: String,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn data<'life0, 'async_trait>(
        &'life0 mut self,
        self_: Resource<Message>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_data<'life0, 'async_trait>(
        &'life0 mut self,
        self_: Resource<Message>,
        data: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn metadata<'life0, 'async_trait>(
        &'life0 mut self,
        self_: Resource<Message>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Metadata>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn add_metadata<'life0, 'async_trait>(
        &'life0 mut self,
        self_: Resource<Message>,
        key: String,
        value: String,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_metadata<'life0, 'async_trait>(
        &'life0 mut self,
        self_: Resource<Message>,
        meta: Metadata,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn remove_metadata<'life0, 'async_trait>(
        &'life0 mut self,
        self_: Resource<Message>,
        key: String,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn drop<'life0, 'async_trait>(
        &'life0 mut self,
        rep: Resource<Message>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

source

fn new<'life0, 'async_trait>( &'life0 mut self, data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<Resource<Message>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn topic<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, ) -> Pin<Box<dyn Future<Output = Result<Option<Topic>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The topic/subject/channel this message was received on, if any

source

fn content_type<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, content_type: String, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the content-type describing the format of the data in the message. This is sometimes described as the “format” type

source

fn data<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

An opaque blob of data

source

fn set_data<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the opaque blob of data for this message, discarding the old value

source

fn metadata<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, ) -> Pin<Box<dyn Future<Output = Result<Option<Metadata>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, key: String, value: String, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Add a new key-value pair to the metadata, overwriting any existing value for the same key

source

fn set_metadata<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, meta: Metadata, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the metadata

source

fn remove_metadata<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, key: String, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Remove a key-value pair from the metadata

source

fn drop<'life0, 'async_trait>( &'life0 mut self, rep: Resource<Message>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementations on Foreign Types§

source§

impl<_T: HostMessage + ?Sized + Send> HostMessage for &mut _T

source§

fn topic<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, ) -> Pin<Box<dyn Future<Output = Result<Option<Topic>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The topic/subject/channel this message was received on, if any

source§

fn content_type<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, content_type: String, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the content-type describing the format of the data in the message. This is sometimes described as the “format” type

source§

fn data<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

An opaque blob of data

source§

fn set_data<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the opaque blob of data for this message, discarding the old value

source§

fn metadata<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, ) -> Pin<Box<dyn Future<Output = Result<Option<Metadata>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, key: String, value: String, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Add a new key-value pair to the metadata, overwriting any existing value for the same key

source§

fn set_metadata<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, meta: Metadata, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the metadata

source§

fn remove_metadata<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Message>, key: String, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Remove a key-value pair from the metadata

source§

fn new<'life0, 'async_trait>( &'life0 mut self, data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<Resource<Message>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn drop<'life0, 'async_trait>( &'life0 mut self, rep: Resource<Message>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§