Skip to main content

Module contract

Module contract 

Source
Expand description

What a trait the activation macro emits leans on (MACRO-13, RETURNS-36), and what is left of the client-implements-the-trait rule (RETURNS-47).

#[plexus_macros::activation(trait = "Foo")] (or a bodiless contract) emits trait Foo, each method under its own return type, boxed: a one-item method’s a BoxFuture of its item, a stream form’s a BoxStream of its items. The activation implements it; the client does not (RETURNS-47, superseding RETURNS-43): its methods answer Result<T, ClientError> or a MethodStream, so a client failure is a Result its caller handles, never a value folded into T, and every item type works — u64, bool, Vec<T> — with nothing to implement.

FromClientError is what that rule asked of every item type. Nothing the macro emits asks for it any more; it stays for the code that implements it.

Traits§

FromClientError
An event type that can carry a client failure in band.
MaybeSend
Send off wasm32, nothing on it: the bound a client puts on what it moves into a boxed future or stream (an Input’s items, BIDIR-6).

Type Aliases§

BoxFuture
A boxed future of T — what a one-item method of an emitted trait returns (RETURNS-36). Send off wasm32, as BoxStream is.
BoxStream
A boxed stream of T — the return type of every method of a trait the activation macro emits. Send off wasm32, as crate::ItemStream is; on wasm32 the browser’s futures are !Send, so the bound is dropped.