1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//! 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.
use crateClientError;
use Stream;
use Future;
use Pin;
/// 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.
pub type BoxStream<'a, T> = ;
/// A boxed stream of `T`. See the non-wasm32 variant.
pub type BoxStream<'a, T> = ;
/// A boxed future of `T` — what a one-item method of an emitted trait
/// returns (RETURNS-36). `Send` off wasm32, as [`BoxStream`] is.
pub type BoxFuture<'a, T> = ;
/// A boxed future of `T`. See the non-wasm32 variant.
pub type BoxFuture<'a, T> = ;
/// `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).
/// See the non-wasm32 variant.
/// An event type that can carry a client failure in band.
///
/// RETURNS-47: no longer required of anything — the generated client
/// implements no trait and answers `Result<T, ClientError>` — and kept for
/// the code that implements it. Before, the client's implementation of an
/// emitted trait yielded a client failure as `E::from_client_error(err)`.
/// An event enum carried it as its in-band error variant:
///
/// ```
/// # #[derive(Debug)] enum EchoEvent { Said { text: String }, Error { message: String } }
/// impl plexus_client::FromClientError for EchoEvent {
/// fn from_client_error(error: plexus_client::ClientError) -> Self {
/// EchoEvent::Error { message: error.to_string() }
/// }
/// }
/// ```
/// A Result item carries a client failure as its error (RETURNS-36).
/// A progress item carries a client failure as its item (RETURNS-36).
/// A string carries a client failure as its message.