Struct rustix::path::DecInt

source ·
pub struct DecInt { /* private fields */ }
Available on crate features fs or net only.
Expand description

Format an integer into a decimal Path component, without constructing a temporary PathBuf or String.

This is used for opening paths such as /proc/self/fd/<fd> on Linux.

Example

use rustix::path::DecInt;

assert_eq!(
    format!("hello {}", DecInt::new(9876).as_ref().display()),
    "hello 9876"
);

Implementations

Construct a new path component from an integer.

Construct a new path component from a file descriptor.

Return the raw byte buffer as a &str.

Return the raw byte buffer as a &CStr.

Return the raw byte buffer.

Trait Implementations

Returns a view of this string as a string slice.
Returns a potentially-lossy rendering of this string as a Cow<'_, str>. Read more
Returns a view of this string as a maybe-owned CStr.
Consumes self and returns a view of this string as a maybe-owned CStr. Read more
Runs a closure with self passed in as a &CStr.
Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.