Skip to main content

MessageEvent

Struct MessageEvent 

Source
pub struct MessageEvent {
    pub code: i32,
    pub numeric: f64,
    pub text: String,
    pub payload: Option<String>,
    pub synchronous: bool,
    pub execution_id: Option<i32>,
}
Expand description

One message, flattened into something that can cross a thread or a wire.

The COM objects a UIMessage refers to are bound to the engine’s apartment and cannot leave it, so what travels is the data a consumer actually needs.

Fields§

§code: i32

The raw message code.

§numeric: f64

The numeric payload.

Serialized so a non-finite value never reaches the wire as null: JSON has no NaN or infinity, and a strictly typed reader that expects a number cannot accept one.

§text: String

The string payload.

§payload: Option<String>

The object payload, as JSON.

A message’s third slot holds an ActiveX reference, which is how a sequence hands over a whole container instead of packing fields into text. That reference is bound to the engine’s process and cannot be sent anywhere, so what survives here is the tree walked into data. None means the slot was empty or the policy declined it.

§synchronous: bool

Whether the posting thread was blocked awaiting acknowledgement.

Informational by the time a subscriber sees it: the host has already acknowledged the message, because holding it would stall the sequence.

§execution_id: Option<i32>

The execution that posted it, when there was one.

Implementations§

Source§

impl MessageEvent

Source

pub const fn is_from_sequence(&self) -> bool

Whether a sequence posted this, rather than the engine.

Source

pub fn engine_code(&self) -> Option<UIMessageCode>

The engine’s name for the code, when it has one.

Source

pub fn from_ui_message( message: &UIMessage, policy: PayloadPolicy, ) -> Result<Self, Error>

Flattens a live message into something that can leave this process.

This is the boundary. Everything a UIMessage refers to is bound to the engine’s apartment; everything on this side of the call is data, and can go to another thread, another process, or a socket.

All three payload slots are carried, including the object one, which is the slot that makes the difference: a sequence can put a container in it and a receiver gets the whole structure without either side agreeing on a text format. policy decides when that is worth the cost.

§Errors

Error if a COM call fails or the object cannot be walked.

Trait Implementations§

Source§

impl Clone for MessageEvent

Source§

fn clone(&self) -> MessageEvent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for MessageEvent

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for MessageEvent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for MessageEvent

Source§

fn eq(&self, other: &MessageEvent) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for MessageEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for MessageEvent

Auto Trait Implementations§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.