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
//! The [`Recipe`] trait: a stable identity for a long-lived message source.
use crateBoxFuture;
use ;
/// A subscription recipe: a user-defined type whose `TypeId` and
/// `Hash` together form a stable, refactor-proof identity for a
/// long-lived message source.
///
/// Most users never write a `Recipe` directly. Instead they use
/// helpers (`zest::time::every`, etc.) that wrap built-in recipes. Power
/// users implementing custom event sources (websockets, GPIO,
/// interrupt handlers) implement this trait.
///
/// ## Identity
///
/// Identity = `TypeId::of::<Self>()` mixed with the `Hash` of `self`.
/// Two recipes of the same type with the same hashable fields are the
/// "same" subscription; the runtime keeps the existing future running
/// across refreshes. Changing the type or any hashed field replaces
/// the subscription.
///
/// ## Driving
///
/// [`next`](Self::next) returns the next future in the message stream.
/// The runtime calls it once on subscription, then again every time
/// the previously-returned future resolves. Returning `None` ends the
/// subscription.
/// Compute the identity hash for a recipe: `TypeId::of::<R>()` mixed
/// with the recipe's own `Hash` impl. Returns a non-zero value (0 is
/// reserved for `Subscription::none`).
pub
/// FNV-1a 64-bit hasher. Used for recipe identity.
;