[][src]Struct rlimit::Resource

pub struct Resource { /* fields omitted */ }

A kind of resource.

Be careful: The documentation of Resource constants are based on Linux and FreeBSD. It may be inconsistent with other platforms.

References

Linux: https://man7.org/linux/man-pages/man2/getrlimit.2.html

FreeBSD: https://www.freebsd.org/cgi/man.cgi?query=getrlimit

Implementations

impl Resource[src]

pub const AS: Self[src]

The maximum size (in bytes) of the process's virtual memory (address space).

pub const CORE: Self[src]

The maximum size (in bytes) of a core file that the process may dump.

pub const CPU: Self[src]

A limit (in seconds) on the amount of CPU time that the process can consume.

pub const DATA: Self[src]

The maximum size (in bytes) of the process's data segment (initialized data, uninitialized data, and heap).

pub const FSIZE: Self[src]

The maximum size (in bytes) of files that the process may create.

pub const MEMLOCK: Self[src]

The maximum number (in bytes) of memory that may be locked into RAM.

pub const NOFILE: Self[src]

This specifies a value one greater than the maximum file descriptor number that can be opened by this process.

pub const NPROC: Self[src]

A limit on the number of extant process (or, more precisely on Linux, threads) for the real user ID of the calling process.

pub const RSS: Self[src]

A limit (in bytes) on the process's resident set (the number of virtual pages resident in RAM).

pub const STACK: Self[src]

The maximum size (in bytes) of the process stack.

impl Resource[src]

pub fn set(self, soft: Rlim, hard: Rlim) -> Result<()>[src]

Set resource limits.

Errors

See setrlimit

pub fn get(self) -> Result<(Rlim, Rlim)>[src]

Get resource limits.

Errors

See getrlimit

#[must_use]pub fn as_name(self) -> &'static str[src]

Returns the name of the resource.

Example

assert_eq!(Resource::NOFILE.as_name(), "RLIMIT_NOFILE");

#[must_use]pub const fn available_names() -> &'static [&'static str][src]

Returns available resource names.

#[must_use]pub const fn available_resources() -> &'static [Self][src]

Returns available resources.

#[must_use]pub const fn as_raw(self) -> RawResource[src]

Returns the raw resource type.

Be careful: The actual type of RawResource can be different on different platforms.

Trait Implementations

impl Clone for Resource[src]

impl Copy for Resource[src]

impl Debug for Resource[src]

impl Eq for Resource[src]

impl FromStr for Resource[src]

type Err = ParseResourceError

The associated error which can be returned from parsing.

impl Hash for Resource[src]

impl PartialEq<Resource> for Resource[src]

impl StructuralEq for Resource[src]

impl StructuralPartialEq for Resource[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.