psp_net/types/
socket_flags.rs

1use bitflags::bitflags;
2
3bitflags! {
4    /// Socket flags to use in send calls
5    #[derive(Clone, Copy, Debug, PartialEq, Eq, Default, Hash)]
6    pub struct SocketSendFlags: u32 {
7        /// No flags passed. Equivalent to `0x0`.
8        const NONE = 0x0;
9        /// Send out-of-band data
10        const MSG_OOB = 0x1;
11        /// End of record
12        const MSG_EOR = 0x8;
13    }
14}
15
16impl SocketSendFlags {
17    /// Convert a [`SocketSendFlags`] into a [`i32`]
18    #[must_use]
19    pub fn as_i32(self) -> i32 {
20        self.bits() as i32
21    }
22}
23
24bitflags! {
25    /// Socket flags to use in recv calls
26    #[derive(Clone, Copy, Debug, PartialEq, Eq, Default, Hash)]
27    pub struct SocketRecvFlags: u32 {
28        /// No flags passed. Equivalent to `0x0`.
29        const NONE = 0x0;
30        /// Process out-of-band data
31        const MSG_OOB = 0x1;
32        /// Peek at the incoming message
33        const MSG_PEEK = 0x2;
34        /// Wait for full message
35        const MSG_WAITALL = 0x40;
36    }
37}
38
39impl SocketRecvFlags {
40    /// Convert a [`SocketRecvFlags`] into a [`i32`]
41    #[must_use]
42    pub fn as_i32(self) -> i32 {
43        self.bits() as i32
44    }
45}