pub struct Payload { /* private fields */ }Expand description
The one internal payload of portable calls: data plus capabilities addressed by
payload-local indices. A bare number in value names nothing outside this payload.
Implementations§
Source§impl Payload
impl Payload
pub fn value(&self) -> &Value
Sourcepub fn map_value(self, map: impl FnOnce(Value) -> Result<Value>) -> Result<Self>
pub fn map_value(self, map: impl FnOnce(Value) -> Result<Value>) -> Result<Self>
Replace the data in place, keeping every capability.
Sourcepub fn attach(&mut self, issued: Issued) -> u32
pub fn attach(&mut self, issued: Issued) -> u32
Attach an owned capability and return its payload-local index for the data slot.
Sourcepub fn attach_argument(&mut self, owner: Owned) -> Result<u32>
pub fn attach_argument(&mut self, owner: Owned) -> Result<u32>
Move an existing resource into an argument. The caller relinquishes its owner now; refused admission consumes and closes it rather than recreating a Wasm handle.
Sourcepub fn attach_moved(&mut self, moved: Moved) -> u32
pub fn attach_moved(&mut self, moved: Moved) -> u32
Attach a move already redeemed by a trusted executor, without duplicating its claim.
Sourcepub fn take_arguments(&mut self) -> Vec<Moved>
pub fn take_arguments(&mut self) -> Vec<Moved>
Consume the typed owned arguments; their data positions are checked by the executor.
Sourcepub fn attach_stream(&mut self, stream: ByteStream) -> u32
pub fn attach_stream(&mut self, stream: ByteStream) -> u32
Attach a stream end and return its payload-local index for the data slot.
Sourcepub fn take_receiver(&mut self) -> Option<Loan>
pub fn take_receiver(&mut self) -> Option<Loan>
Take the implicit self loan of this call, if any.
Sourcepub fn issue<T: Issuable>(&mut self, value: T) -> Slot
pub fn issue<T: Issuable>(&mut self, value: T) -> Slot
Issue a Rust value as a capability of its WIT resource type. Place the returned Slot
where the result’s data names the resource, and serialize that result with
Payload::encode. The value is this payload’s until the call returns it: then it
belongs to the issuing object, and the delivered handle names it.
Sourcepub fn encode(self, result: impl Serialize) -> Result<Self>
pub fn encode(self, result: impl Serialize) -> Result<Self>
Replace the data with a serialized result, whose resource positions hold the slots this payload issued.
Sourcepub fn receiver<T: Issuable>(&mut self) -> Result<Receiver<T>>
pub fn receiver<T: Issuable>(&mut self) -> Result<Receiver<T>>
Take the implicit self of this call as the value it was issued from. A call without
self is refused, as is a self of another resource type (Forbidden/resource), of
another object or a retired revision of the exporter, or one that has closed
(Gone/resource).
Sourcepub fn receive<T: Issuable>(&self, moved: Moved) -> Result<T>
pub fn receive<T: Issuable>(&self, moved: Moved) -> Result<T>
Receive a moved native value only in its exact issuing object and resource type. Outstanding method guards keep their value alive and prevent exclusive extraction.
Sourcepub fn into_data(self) -> Result<Value>
pub fn into_data(self) -> Result<Value>
Return the data of a call to an exporter’s function without self: a self lent to it
is refused as a compiled exporter’s function refuses it, Invalid/resource, and any other
capability as a data-only boundary refuses it, Invalid/local_value. Refused, they drop
and so close.
Trait Implementations§
Source§impl From<Payload> for Outcome
An ordinary result: the call has physically ended when it returns.
impl From<Payload> for Outcome
An ordinary result: the call has physically ended when it returns.