pub struct Message {
pub sender: u64,
pub reply_cap: u64,
pub request_id: u64,
pub tag: u16,
pub payload: u64,
}Expand description
Fixed-size envelope carried in mailboxes and registers (Atomic Hop).
§Why this exists (request-reply / typed protocols)
Receive delivers a single Value — not {sender, Value}. Without an
envelope, a server flow cannot learn who sent a request, and two clients
cannot safely share a request_id space.
§Security
sender: FlowId stamped by the scheduler on bytecodeSend/Ask(invariant S1). Not a capability.reply_cap: CapId minted at the same boundary with SEND-only rights so the recipient can answer without ambient Pid addressing (phase 2). Zero means “no reply grant” (host-injected hops may omit it).
See docs/security.md.
Fields§
§sender: u64Authenticated origin FlowId (0 = trusted host / non-flow).
reply_cap: u64Capability granting SEND back to Self::sender, or 0.
request_id: u64Client correlation token; echoed on replies (Ask / S2).
tag: u16Protocol discriminator (opaque to the VM).
payload: u64Small protocol payload.
Implementations§
Source§impl Message
impl Message
Sourcepub const fn new(sender: u64, request_id: u64, tag: u16, payload: u64) -> Self
pub const fn new(sender: u64, request_id: u64, tag: u16, payload: u64) -> Self
Build an envelope. sender / reply_cap are placeholders until a
bytecode hop is authenticated by the scheduler (reply_cap typically
0 here).
Sourcepub const fn request(request_id: u64, tag: u16, payload: u64) -> Self
pub const fn request(request_id: u64, tag: u16, payload: u64) -> Self
Outgoing hop from host Rust (sender / reply_cap filled on delivery).
Sourcepub fn reply_to(req: &Self, tag: u16, payload: u64) -> Self
pub fn reply_to(req: &Self, tag: u16, payload: u64) -> Self
Reply envelope echoing request_id from a received hop (host path).
Sourcepub const fn down(monitor: u64, target_flow: u64, reason: u64) -> Self
pub const fn down(monitor: u64, target_flow: u64, reason: u64) -> Self
Runtime lifecycle hop: monitor DOWN (tag == TAG_SYS_DOWN).
sender is the dead flow’s identity (not a Cap). request_id is the
crate::MonitorRef. payload is crate::FlowExitReason as u64.
Sourcepub const fn linked_exit(target_flow: u64, reason: u64) -> Self
pub const fn linked_exit(target_flow: u64, reason: u64) -> Self
Runtime lifecycle hop: Ask target exited (tag == TAG_SYS_EXIT).
Written into the Ask dest register when the callee dies before
replying. payload is crate::FlowExitReason.
pub const fn is_down(self) -> bool
pub const fn is_exit(self) -> bool
Trait Implementations§
impl Copy for Message
impl Eq for Message
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.