Skip to main content

Module contract

Module contract 

Source
Expand description

MACRO-13 · what a trait the activation macro emits leans on.

#[plexus_macros::activation(trait)] on impl FooActivation emits trait Foo: every wire method as fn(&self, ..) -> BoxStream<'static, E>, implemented by the activation and by FooClient<T>. A client call is a stream of Result<ClientEvent<E>, ClientError>; a trait method is a stream of E. This module is the bridge:

  • FromClientError — how a client failure becomes the event type’s own in-band error (one line, usually Error { message }), so a caller of dyn Foo sees one shape whether it is talking to a local implementation or a remote one;
  • owned_call — a 'static call from an owned transport, since a trait method’s stream outlives the &self it was called on;
  • into_events / error_events — the mapping itself: a data event is yielded, a progress report is dropped, an error is yielded as E::from_client_error(err) and ends the stream.

Traits§

FromClientError
An event type that can carry a client failure in band.

Functions§

error_events
A trait method’s stream that yields E::from_client_error(error) and ends — what an emitted client method returns when a parameter would not serialize.
into_events
A typed client stream as a trait method’s stream: data events yielded, progress dropped, the first error yielded as E::from_client_error(err) and the stream ended there.
owned_call
Transport::call on a transport the stream owns, so the stream is 'static: a trait method returns a stream that outlives the &self it was called on, and Transport::call borrows its transport.

Type Aliases§

BoxStream
A boxed stream of T — the return type of every method of a trait the activation macro emits. Send off wasm32, as ItemStream is; on wasm32 the browser’s futures are !Send, so the bound is dropped.