pub struct Request<TReq, TResp>
where TReq: PayloadSerialize, TResp: PayloadSerialize,
{ pub payload: TReq, pub content_type: Option<String>, pub format_indicator: FormatIndicator, pub custom_user_data: Vec<(String, String)>, pub timestamp: Option<HybridLogicalClock>, pub invoker_id: Option<String>, pub topic_tokens: HashMap<String, String>, /* private fields */ }
Expand description

Command Executor Request struct. Used by the Executor

If dropped, executor will send an error response to the invoker

Fields§

§payload: TReq

Payload of the command request.

§content_type: Option<String>

Content Type of the command request.

§format_indicator: FormatIndicator

Format Indicator of the command request.

§custom_user_data: Vec<(String, String)>

Custom user data set as custom MQTT User Properties on the request message.

§timestamp: Option<HybridLogicalClock>

Timestamp of the command request.

§invoker_id: Option<String>

If present, contains the client ID of the invoker of the command.

§topic_tokens: HashMap<String, String>

Resolved static and dynamic topic tokens from the incoming request’s topic.

Implementations§

Source§

impl<TReq, TResp> Request<TReq, TResp>
where TReq: PayloadSerialize, TResp: PayloadSerialize,

Source

pub async fn complete( self, response: Response<TResp>, ) -> Result<(), AIOProtocolError>

Consumes the command request and reports the response to the executor. An attempt is made to send the response to the invoker.

Returns Ok(()) on success, otherwise returns AIOProtocolError.

§Arguments
§Errors

AIOProtocolError of kind Timeout if the command request has expired.

AIOProtocolError of kind ClientError if the response acknowledgement returns an error.

AIOProtocolError of kind Cancellation if the executor is dropped.

AIOProtocolError of kind InternalLogicError if the response publish completion fails. This should not happen.

Source

pub fn is_cancelled(&self) -> bool

Check if the command response is no longer expected.

Returns true if the response is no longer expected, otherwise returns false.

Auto Trait Implementations§

§

impl<TReq, TResp> Freeze for Request<TReq, TResp>
where TReq: Freeze,

§

impl<TReq, TResp> !RefUnwindSafe for Request<TReq, TResp>

§

impl<TReq, TResp> Send for Request<TReq, TResp>
where TReq: Send, TResp: Send,

§

impl<TReq, TResp> Sync for Request<TReq, TResp>
where TReq: Sync, TResp: Send,

§

impl<TReq, TResp> Unpin for Request<TReq, TResp>
where TReq: Unpin,

§

impl<TReq, TResp> !UnwindSafe for Request<TReq, TResp>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V