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
//! `SocketEvent` enum emitted by the monitor channel.
use crateEndpoint;
use cratePeerIdentity;
use crateZmqError;
/// Event emitted by the socket monitor channel (see [`Socket::monitor`](crate::Socket::monitor)).
///
/// Event kinds match libzmq's `ZMQ_EVENT_*` constants —
/// see [`zmq_socket_monitor(3)`](https://libzmq.readthedocs.io/en/latest/zmq_socket_monitor.html).
///
/// `SocketEvent` is `#[non_exhaustive]`. New variants may be added in
/// minor releases — pattern matches must include a `_` arm.
///
/// # Example
///
/// ```rust,no_run
/// use rustzmq2::SocketEvent;
///
/// fn describe(ev: &SocketEvent) -> String {
/// match ev {
/// SocketEvent::Listening(ep) => format!("listening on {ep}"),
/// SocketEvent::Accepted(ep, id) => format!("accept {ep} id={id}"),
/// SocketEvent::Connected(ep, id) => format!("connect {ep} id={id}"),
/// SocketEvent::Disconnected(id) => format!("disconnect id={id}"),
/// SocketEvent::AcceptFailed(err) => format!("accept failed: {err}"),
/// SocketEvent::OptionIgnoredOnTransport { option, endpoint } => {
/// format!("option `{option}` ignored on {endpoint}")
/// }
/// _ => "other".into(),
/// }
/// }
/// ```