Skip to main content

dope_sys/io/socket/option/
mod.rs

1mod cursor;
2pub mod fast;
3mod step;
4pub mod tuning;
5mod value;
6
7pub use cursor::Cursor;
8pub use step::Step;
9pub use value::Value;
10mod kind;
11mod source;
12
13pub use kind::Kind;
14pub use source::Source;
15
16/// One kernel option level, e.g. a protocol number or the socket level.
17#[derive(Clone, Copy, Debug, Eq, PartialEq)]
18#[repr(transparent)]
19pub struct Level(libc::c_int);
20
21impl Level {
22    pub const fn new(raw: i32) -> Self {
23        Self(raw)
24    }
25
26    pub const fn raw(self) -> i32 {
27        self.0
28    }
29}
30
31/// One kernel option name within its level.
32#[derive(Clone, Copy, Debug, Eq, PartialEq)]
33#[repr(transparent)]
34pub struct Name(libc::c_int);
35
36impl Name {
37    pub const fn new(raw: i32) -> Self {
38        Self(raw)
39    }
40
41    pub const fn raw(self) -> i32 {
42        self.0
43    }
44}
45
46const _: () = {
47    assert!(size_of::<Level>() == size_of::<i32>());
48    assert!(size_of::<Name>() == size_of::<i32>());
49};