IncomingMessageContent

Struct IncomingMessageContent 

Source
pub struct IncomingMessageContent<T, P>{ /* private fields */ }

Implementations§

Source§

impl<String: Deref<Target = str>> IncomingMessageContent<String, IncomingEventProperties>

Source

pub fn convert_payload<T>(message: &IncomingEvent<String>) -> Result<T, Error>

Source

pub fn convert<T>( message: IncomingEvent<String>, ) -> Result<IncomingEvent<T>, Error>

Source§

impl<T> IncomingMessageContent<T, IncomingRequestProperties>

Source

pub fn to_response<R>( &self, data: R, status: ResponseStatus, timing: OutgoingShortTermTimingProperties, api_version: &str, ) -> OutgoingMessage<R>
where R: Serialize,

Builds OutgoingResponse based on the IncomingRequest.

Use it to response on a request.

§Arguments
  • data – serializable response payload.
  • status – response status.
  • timing – outgoing response’s short term timing properties.
§Example
let response = request.to_response(
    json!({ "foo": "bar" }),
    ResponseStatus::OK,
    OutgoingShortTermTimingProperties::until_now(start_timestamp),
);
Source§

impl<String: Deref<Target = str>> IncomingMessageContent<String, IncomingRequestProperties>

Source

pub fn convert_payload<T>(message: &IncomingRequest<String>) -> Result<T, Error>

Source

pub fn convert<T>( message: IncomingRequest<String>, ) -> Result<IncomingRequest<T>, Error>

Source§

impl<String: Deref<Target = str>> IncomingMessageContent<String, IncomingResponseProperties>

Source

pub fn convert_payload<T>( message: &IncomingResponse<String>, ) -> Result<T, Error>

Source

pub fn convert<T>( message: IncomingResponse<String>, ) -> Result<IncomingResponse<T>, Error>

Source§

impl<T, P> IncomingMessageContent<T, P>

Source

pub fn new(payload: T, properties: P) -> Self

Source

pub fn payload(&self) -> &T

Source

pub fn extract_payload(self) -> T

Source

pub fn properties(&self) -> &P

Source

pub fn properties_mut(&mut self) -> &mut P

Trait Implementations§

Source§

impl<T: Clone, P> Clone for IncomingMessageContent<T, P>

Source§

fn clone(&self) -> IncomingMessageContent<T, P>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, P> Debug for IncomingMessageContent<T, P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, P> Freeze for IncomingMessageContent<T, P>
where T: Freeze, P: Freeze,

§

impl<T, P> RefUnwindSafe for IncomingMessageContent<T, P>

§

impl<T, P> Send for IncomingMessageContent<T, P>
where T: Send,

§

impl<T, P> Sync for IncomingMessageContent<T, P>
where T: Sync,

§

impl<T, P> Unpin for IncomingMessageContent<T, P>
where T: Unpin, P: Unpin,

§

impl<T, P> UnwindSafe for IncomingMessageContent<T, P>
where T: UnwindSafe, P: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.