use super::super::resource::Resource;
impl Resource {
#[must_use]
pub(super) const fn as_raw_type(&self) -> Option<std::ffi::c_int> {
match *self {
#[cfg(not(any(target_env = "newlib", target_os = "redox")))]
Self::AS => Some(libc::RLIMIT_AS as _),
Self::CORE => Some(libc::RLIMIT_CORE as _),
Self::CPU => Some(libc::RLIMIT_CPU as _),
Self::DATA => Some(libc::RLIMIT_DATA as _),
Self::FSIZE => Some(libc::RLIMIT_FSIZE as _),
#[cfg(target_os = "freebsd")]
Self::KQUEUES => Some(libc::RLIMIT_KQUEUES as _),
#[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten"))]
Self::LOCKS => Some(libc::RLIMIT_LOCKS as _),
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "openbsd",
target_os = "netbsd",
target_os = "linux",
target_os = "android",
target_os = "emscripten",
target_os = "nto"
))]
Self::MEMLOCK => Some(libc::RLIMIT_MEMLOCK as _),
#[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten"))]
Self::MSGQUEUE => Some(libc::RLIMIT_MSGQUEUE as _),
#[cfg(any(target_os = "linux", target_os = "android"))]
Self::NICE => Some(libc::RLIMIT_NICE as _),
Self::NOFILE => Some(libc::RLIMIT_NOFILE as _),
#[cfg(any(
target_os = "aix",
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "openbsd",
target_os = "netbsd",
target_os = "linux",
target_os = "android",
target_os = "emscripten",
target_os = "nto"
))]
Self::NPROC => Some(libc::RLIMIT_NPROC as _),
#[cfg(any(
target_os = "aix",
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "openbsd",
target_os = "netbsd",
target_os = "linux",
target_os = "android",
target_os = "emscripten",
target_os = "nto"
))]
Self::RSS => Some(libc::RLIMIT_RSS as _),
#[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten"))]
Self::RTPRIO => Some(libc::RLIMIT_RTPRIO as _),
#[cfg(target_os = "linux")]
Self::RTTIME => Some(libc::RLIMIT_RTTIME as _),
#[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "netbsd"))]
Self::SBSIZE => Some(libc::RLIMIT_SBSIZE as _),
#[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten"))]
Self::SIGPENDING => Some(libc::RLIMIT_SIGPENDING as _),
Self::STACK => Some(libc::RLIMIT_STACK as _),
#[cfg(target_os = "freebsd")]
Self::SWAP => Some(libc::RLIMIT_SWAP as _),
_ => None,
}
}
}