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
//! Options available to configure NNG constructs.
//!
//! Many of the options are transport or protocol specific. Additionally, even
//! though the Socket does not have a specific transport, it is able to accept
//! transport options to be used as defaults for any new Dialers or Listeners.
//!
//! Additionally, a Dialer or Listener is able to read options from the
//! underlying Socket but they are unable to write options unless they are
//! directly supported.
use crateResult;
pub use *;
pub
/// Trait for getting and setting options.
///
/// This trait allows for the getting and setting of options as long as that
/// option is available. An example of this would be the `Raw` option - it is a
/// read-only option that is available exclusively to sockets. So the following
/// code will work:
///
/// ```
/// use nng::options::{Options, Raw};
/// use nng::*;
///
/// let socket = Socket::new(Protocol::Pub0).unwrap();
/// let raw = socket.get_opt::<Raw>().unwrap();
/// assert!(!raw);
/// ```
///
/// But all this is a compile error:
///
/// ```compile_fail
/// use nng::options::{Options, Raw};
/// use nng::*;
///
/// let socket = Socket::new(Protocol::Pub0).unwrap();
/// socket.set_opt::<Raw>(true).unwrap(); // Won't compile
/// ```
/// Marks the type as an NNG option.
/// Marks that a type can get the specific NNG option.
/// Marks that a type can set the specific NNG option.