Struct DecInt

struct DecInt { ... }

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.

Examples

# #[cfg(any(feature = "fs", feature = "net"))]
use rustix::path::DecInt;

# #[cfg(any(feature = "fs", feature = "net"))]
assert_eq!(
    format!("hello {}", DecInt::new(9876).as_ref().display()),
    "hello 9876"
);

Implementations

impl DecInt

fn new<Int: Integer>(i: Int) -> Self

Construct a new path component from an integer.

fn from_fd<Fd: AsFd>(fd: Fd) -> Self

Construct a new path component from a file descriptor.

fn as_str(self: &Self) -> &str

Return the raw byte buffer as a &str.

fn as_c_str(self: &Self) -> &CStr

Return the raw byte buffer as a &CStr.

fn as_bytes_with_nul(self: &Self) -> &[u8]

Return the raw byte buffer including the NUL byte.

fn as_bytes(self: &Self) -> &[u8]

Return the raw byte buffer.

impl Arg for DecInt

fn as_str(self: &Self) -> Result<&str>
fn to_string_lossy(self: &Self) -> Cow<'_, str>
fn as_cow_c_str(self: &Self) -> Result<Cow<'_, CStr>>
fn into_c_str<'b>(self: Self) -> Result<Cow<'b, CStr>>
where
    Self: 'b
fn into_with_c_str<T, F>(self: Self, f: F) -> Result<T>
where
    Self: Sized,
    F: FnOnce(&CStr) -> Result<T>

impl AsRef for DecInt

fn as_ref(self: &Self) -> &Path

impl Clone for DecInt

fn clone(self: &Self) -> DecInt

impl Debug for DecInt

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl Freeze for DecInt

impl RefUnwindSafe for DecInt

impl Send for DecInt

impl Sync for DecInt

impl Unpin for DecInt

impl UnsafeUnpin for DecInt

impl UnwindSafe for DecInt

impl<T> Any for DecInt

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for DecInt

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for DecInt

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for DecInt

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for DecInt

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for DecInt

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for DecInt

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for DecInt

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for DecInt

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>