dope_sys/io/socket/option/
value.rs1use std::mem;
2
3#[derive(Clone, Copy, Debug, Eq, PartialEq)]
5#[repr(transparent)]
6pub struct Value(libc::c_int);
7
8impl Value {
9 pub const ZERO: Self = Self(0);
10
11 pub const fn new(raw: i32) -> Self {
12 Self(raw)
13 }
14
15 pub const fn raw(self) -> i32 {
16 self.0
17 }
18
19 pub const fn is_zero(self) -> bool {
20 self.0 == 0
21 }
22
23 pub const fn from_enabled(enabled: bool) -> Self {
25 Self(enabled as libc::c_int)
26 }
27}
28
29const _: () = {
30 assert!(mem::size_of::<Value>() == mem::size_of::<i32>());
31};