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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
use std::fmt;
/// Describes a relationship between a socket and all sockets to which it is
/// connected.
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum Protocol
{
/// Version 0 of the bus protocol.
///
/// The _bus_ protocol provides for building mesh networks where every peer
/// is connected to every other peer. In this protocol, each message sent
/// by a node is sent to every one of its directly connected peers. See
/// the [bus documentation][1] for more information.
///
/// [1]: https://nanomsg.github.io/nng/man/v1.2.2/nng_bus.7.html
Bus0,
/// Version 0 of the pair protocol.
///
/// The _pair_ protocol implements a peer-to-peer pattern, where
/// relationships between peers are one-to-one. See the
/// [pair documentation][1] for more information.
///
/// [1]: https://nanomsg.github.io/nng/man/v1.2.2/nng_pair.7.html
Pair0,
/// Version 1 of the pair protocol.
///
/// The _pair_ protocol implements a peer-to-peer pattern, where
/// relationships between peers are one-to-one. See the [pair
/// documentation][1] for more information.
///
/// [1]: https://nanomsg.github.io/nng/man/v1.2.2/nng_pair.7.html
Pair1,
/// Version 0 of the publisher protocol.
///
/// The _pub_ protocol is one half of a publisher/subscriber pattern. In
/// this pattern, a publisher sends data, which is broadcast to all
/// subscribers. The subscribing applications only see the data to which
/// they have subscribed. See the [publisher/subscriber documentation][1]
/// for more information.
///
/// [1]: https://nanomsg.github.io/nng/man/v1.2.2/nng_pub.7.html
Pub0,
/// Version 0 of the pull protocol.
///
/// The _pull_ protocol is one half of a pipeline pattern. The other half
/// is the _push_ protocol. In the pipeline pattern, pushers distribute
/// messages to pullers. Each message sent by a pusher will be sent to one
/// of its peer pullers, chosen in a round-robin fashion from the set of
/// connected peers available for receiving. This property makes this
/// pattern useful in load-balancing scenarios.
///
/// See the [pipeline documentation][1] for more information.
///
/// [1]: https://nanomsg.github.io/nng/man/v1.2.2/nng_pull.7.html
Pull0,
/// Version 0 of the push protocol.
///
/// The _push_ protocol is one half of a pipeline pattern. The other side
/// is the _pull_ protocol. In the pipeline pattern, pushers distribute
/// messages to pullers. Each message sent by a pusher will be sent to one
/// of its peer pullers, chosen in a round-robin fashion from the set of
/// connected peers available for receiving. This property makes this
/// pattern useful in load-balancing scenarios.
///
/// See the [pipeline documentation][1] for more information.
///
/// [1]: https://nanomsg.github.io/nng/man/v1.2.2/nng_push.7.html
Push0,
/// Version 0 of the reply protocol.
///
/// The _rep_ protocol is one half of a request/reply pattern. In this
/// pattern, a requester sends a message to one replier, who is expected to
/// reply. The request is resent if no reply arrives, until a reply is
/// received or the request times out.
///
/// See the [request/reply documentation][1] for more information.
///
/// [1]: https://nanomsg.github.io/nng/man/v1.2.2/nng_rep.7.html
Rep0,
/// Version 0 of the request protocol.
///
/// The _req_ protocol is one half of a request/reply pattern. In this
/// pattern, a requester sends a message to one replier, who is expected to
/// reply. The request is resent if no reply arrives, until a reply is
/// received or the request times out.
///
/// See the [request/reply documentation][1] for more information.
///
/// [1]: https://nanomsg.github.io/nng/man/v1.2.2/nng_req.7.html
Req0,
/// Version 0 of the respondent protocol.
///
/// The _respondent_ protocol is one half of a survey pattern. In this
/// pattern, a surveyor sends a survey, which is broadcast to all peer
/// respondents. The respondents then have a chance to reply (but are not
/// obliged to reply). The survey itself is a timed event, so that
/// responses received after the survey has finished are discarded.
///
/// See the [survery documentation][1] for more information.
///
/// [1]: https://nanomsg.github.io/nng/man/v1.2.2/nng_respondent.7.html
Respondent0,
/// Version 0 of the subscriber protocol.
///
/// The _sub_ protocol is one half of a publisher/subscriber pattern. In
/// this pattern, a publisher sends data, which is broadcast to all
/// subscribers. The subscribing applications only see the data to which
/// they have subscribed.
///
/// See the [publisher/subscriber documentation][1] for more information.
///
/// [1]: https://nanomsg.github.io/nng/man/v1.2.2/nng_sub.7.html
Sub0,
/// Version 0 of the surveyor protocol.
///
/// The _surveyor_ protocol is one half of a survey pattern. In this
/// pattern, a surveyor sends a survey, which is broadcast to all peer
/// respondents. The respondents then have a chance to reply (but are not
/// obliged to reply). The survey itself is a timed event, so that
/// responses received after the survey has finished are discarded.
///
/// See the [survey documentation][1] for more information.
///
/// [1]: https://nanomsg.github.io/nng/man/v1.2.2/nng_surveyor.7.html
Surveyor0,
}
#[allow(clippy::use_debug)]
impl fmt::Display for Protocol
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self) }
}