Skip to main content

RedoxStr

Enum RedoxStr 

Source
pub enum RedoxStr<'a> {
    Absolute(RedoxPath<'a>),
    Relative(RedoxReference<'a>),
}
Expand description

A valid path (checked against NUL) that can be fully qualified RedoxPath or relative RedoxReference

Variants§

§

Absolute(RedoxPath<'a>)

§

Relative(RedoxReference<'a>)

Implementations§

Source§

impl<'a> RedoxStr<'a>

Source

pub fn new<S: Into<Cow<'a, str>>>(path: S) -> Option<Self>

Create a RedoxStr from a string, returns None if it contains NUL

Source

pub fn new_from_c<S: Into<&'a CStr>>(path: S) -> Option<Self>

Create a RedoxStr from a buf, returns None if it not a valid UTF-8 or valid from NUL

Source

pub fn new_from_buf(path: &'a [u8], len: usize) -> Option<RedoxStr<'a>>

Create a RedoxStr from a buf, returns None if it not a valid UTF-8 or contains NUL

Source

pub unsafe fn new_unchecked<S: Into<Cow<'a, str>>>(path: S) -> Self

SAFETY: Caller ensures that path contains no NUL character

Source

pub fn as_abs(&'a self) -> Option<&'a RedoxPath<'a>>

Get the reference to absolute path

Source

pub fn as_rel(&'a self) -> Option<&'a RedoxReference<'a>>

Get the reference to relative path

Source

pub fn abs(self) -> Option<RedoxPath<'a>>

Get the absolute path

Source

pub fn rel(self) -> Option<RedoxReference<'a>>

Get the relative path

Source

pub fn is_canon(&self) -> bool

Is this path canonicalized?

Source

pub fn canonical(self) -> Self

Convert into canonicalized path

Source

pub fn to_standard(self) -> RedoxReference<'a>

Convert into standard UNIX style path

Source

pub fn dirname<'b>(&self) -> RedoxStr<'b>

Get path upward one time

Source

pub fn dirname_split(&'a self) -> (RedoxStr<'a>, Option<RedoxReference<'a>>)

Get path upward one time and the file name

Source

pub fn is_empty(&self) -> bool

This is path empty?

Source

pub fn join<'b, S: Into<Cow<'b, str>>>(&self, path: S) -> Option<RedoxStr<'b>>

Join two path

Source

pub fn join_checked<'b>(&self, path: RedoxReference<'b>) -> RedoxStr<'b>

Join two path

Source

pub fn is_relative(&self) -> bool

Is this path relative?

Source

pub fn into_owned<'b>(self) -> RedoxStr<'b>

Copy the content into owned

Trait Implementations§

Source§

impl<'a> Clone for RedoxStr<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for RedoxStr<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> Eq for RedoxStr<'a>

Source§

impl<'a> From<RedoxPath<'a>> for RedoxStr<'a>

Source§

fn from(value: RedoxPath<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<RedoxReference<'a>> for RedoxStr<'a>

Source§

fn from(value: RedoxReference<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<RedoxStr<'a>> for Cow<'a, str>

Source§

fn from(value: RedoxStr<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> Hash for RedoxStr<'a>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> PartialEq for RedoxStr<'a>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for RedoxStr<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for RedoxStr<'a>

§

impl<'a> RefUnwindSafe for RedoxStr<'a>

§

impl<'a> Send for RedoxStr<'a>

§

impl<'a> Sync for RedoxStr<'a>

§

impl<'a> Unpin for RedoxStr<'a>

§

impl<'a> UnsafeUnpin for RedoxStr<'a>

§

impl<'a> UnwindSafe for RedoxStr<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.