Make cloudapi enums #[non_exhaustive]

This commit is contained in:
varkor
2018-08-15 16:58:53 +01:00
parent ea505fd60b
commit f541ab226c

View File

@@ -121,6 +121,7 @@ include!("bitflags.rs");
/// File or memory access pattern advisory information. /// File or memory access pattern advisory information.
#[repr(u8)] #[repr(u8)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
#[non_exhaustive]
pub enum advice { pub enum advice {
/// The application expects that it will not access the /// The application expects that it will not access the
/// specified data in the near future. /// specified data in the near future.
@@ -140,12 +141,12 @@ pub enum advice {
/// The application expects to access the specified data /// The application expects to access the specified data
/// in the near future. /// in the near future.
WILLNEED = 6, WILLNEED = 6,
#[doc(hidden)] _NonExhaustive = -1 as isize as u8,
} }
/// Enumeration describing the kind of value stored in [`auxv`](struct.auxv.html). /// Enumeration describing the kind of value stored in [`auxv`](struct.auxv.html).
#[repr(u32)] #[repr(u32)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
#[non_exhaustive]
pub enum auxtype { pub enum auxtype {
/// Base address of the binary argument data provided to /// Base address of the binary argument data provided to
/// [`proc_exec()`](fn.proc_exec.html). /// [`proc_exec()`](fn.proc_exec.html).
@@ -210,12 +211,12 @@ pub enum auxtype {
SYSINFO_EHDR = 262, SYSINFO_EHDR = 262,
/// Thread ID of the initial thread of the process. /// Thread ID of the initial thread of the process.
TID = 261, TID = 261,
#[doc(hidden)] _NonExhaustive = -1 as isize as u32,
} }
/// Identifiers for clocks. /// Identifiers for clocks.
#[repr(u32)] #[repr(u32)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
#[non_exhaustive]
pub enum clockid { pub enum clockid {
/// The system-wide monotonic clock, which is defined as a /// The system-wide monotonic clock, which is defined as a
/// clock measuring real time, whose value cannot be /// clock measuring real time, whose value cannot be
@@ -232,7 +233,6 @@ pub enum clockid {
REALTIME = 3, REALTIME = 3,
/// The CPU-time clock associated with the current thread. /// The CPU-time clock associated with the current thread.
THREAD_CPUTIME_ID = 4, THREAD_CPUTIME_ID = 4,
#[doc(hidden)] _NonExhaustive = -1 as isize as u32,
} }
/// A userspace condition variable. /// A userspace condition variable.
@@ -267,6 +267,7 @@ pub const DIRCOOKIE_START: dircookie = dircookie(0);
/// exclusively or merely provided for alignment with POSIX. /// exclusively or merely provided for alignment with POSIX.
#[repr(u16)] #[repr(u16)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
#[non_exhaustive]
pub enum errno { pub enum errno {
/// No error occurred. System call completed successfully. /// No error occurred. System call completed successfully.
SUCCESS = 0, SUCCESS = 0,
@@ -422,7 +423,6 @@ pub enum errno {
XDEV = 75, XDEV = 75,
/// Extension: Capabilities insufficient. /// Extension: Capabilities insufficient.
NOTCAPABLE = 76, NOTCAPABLE = 76,
#[doc(hidden)] _NonExhaustive = -1 as isize as u16,
} }
bitflags! { bitflags! {
@@ -438,6 +438,7 @@ bitflags! {
/// Type of a subscription to an event or its occurrence. /// Type of a subscription to an event or its occurrence.
#[repr(u8)] #[repr(u8)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
#[non_exhaustive]
pub enum eventtype { pub enum eventtype {
/// The time value of clock [`subscription.union.clock.clock_id`](struct.subscription_clock.html#structfield.clock_id) /// The time value of clock [`subscription.union.clock.clock_id`](struct.subscription_clock.html#structfield.clock_id)
/// has reached timestamp [`subscription.union.clock.timeout`](struct.subscription_clock.html#structfield.timeout). /// has reached timestamp [`subscription.union.clock.timeout`](struct.subscription_clock.html#structfield.timeout).
@@ -463,7 +464,6 @@ pub enum eventtype {
/// The process associated with process descriptor /// The process associated with process descriptor
/// [`subscription.union.proc_terminate.fd`](struct.subscription_proc_terminate.html#structfield.fd) has terminated. /// [`subscription.union.proc_terminate.fd`](struct.subscription_proc_terminate.html#structfield.fd) has terminated.
PROC_TERMINATE = 7, PROC_TERMINATE = 7,
#[doc(hidden)] _NonExhaustive = -1 as isize as u8,
} }
/// Exit code generated by a process when exiting. /// Exit code generated by a process when exiting.
@@ -530,6 +530,7 @@ pub type filesize = u64;
/// The type of a file descriptor or file. /// The type of a file descriptor or file.
#[repr(u8)] #[repr(u8)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
#[non_exhaustive]
pub enum filetype { pub enum filetype {
/// The type of the file descriptor or file is unknown or /// The type of the file descriptor or file is unknown or
/// is different from any of the other types specified. /// is different from any of the other types specified.
@@ -558,7 +559,6 @@ pub enum filetype {
SOCKET_STREAM = 130, SOCKET_STREAM = 130,
/// The file refers to a symbolic link inode. /// The file refers to a symbolic link inode.
SYMBOLIC_LINK = 144, SYMBOLIC_LINK = 144,
#[doc(hidden)] _NonExhaustive = -1 as isize as u8,
} }
bitflags! { bitflags! {
@@ -847,12 +847,12 @@ bitflags! {
/// memory. /// memory.
#[repr(u8)] #[repr(u8)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
#[non_exhaustive]
pub enum scope { pub enum scope {
/// The object is stored in private memory. /// The object is stored in private memory.
PRIVATE = 4, PRIVATE = 4,
/// The object is stored in shared memory. /// The object is stored in shared memory.
SHARED = 8, SHARED = 8,
#[doc(hidden)] _NonExhaustive = -1 as isize as u8,
} }
bitflags! { bitflags! {
@@ -878,6 +878,7 @@ bitflags! {
/// Signal condition. /// Signal condition.
#[repr(u8)] #[repr(u8)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
#[non_exhaustive]
pub enum signal { pub enum signal {
/// Process abort signal. /// Process abort signal.
/// ///
@@ -983,7 +984,6 @@ pub enum signal {
/// ///
/// Action: Terminates the process. /// Action: Terminates the process.
XFSZ = 26, XFSZ = 26,
#[doc(hidden)] _NonExhaustive = -1 as isize as u8,
} }
bitflags! { bitflags! {
@@ -1049,6 +1049,7 @@ pub type userdata = u64;
/// should be set. /// should be set.
#[repr(u8)] #[repr(u8)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
#[non_exhaustive]
pub enum whence { pub enum whence {
/// Seek relative to current position. /// Seek relative to current position.
CUR = 1, CUR = 1,
@@ -1056,7 +1057,6 @@ pub enum whence {
END = 2, END = 2,
/// Seek relative to start-of-file. /// Seek relative to start-of-file.
SET = 3, SET = 3,
#[doc(hidden)] _NonExhaustive = -1 as isize as u8,
} }
/// Auxiliary vector entry. /// Auxiliary vector entry.