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: i32The raw message code.
numeric: f64The 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: StringThe 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: boolWhether 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
impl MessageEvent
Sourcepub const fn is_from_sequence(&self) -> bool
pub const fn is_from_sequence(&self) -> bool
Whether a sequence posted this, rather than the engine.
Sourcepub fn engine_code(&self) -> Option<UIMessageCode>
pub fn engine_code(&self) -> Option<UIMessageCode>
The engine’s name for the code, when it has one.
Sourcepub fn from_ui_message(
message: &UIMessage,
policy: PayloadPolicy,
) -> Result<Self, Error>
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
impl Clone for MessageEvent
Source§fn clone(&self) -> MessageEvent
fn clone(&self) -> MessageEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more