CrossPath

Struct CrossPath 

Source
pub struct CrossPath { /* private fields */ }
Expand description

Main cross-platform path structure

Implementations§

Source§

impl CrossPath

Source

pub fn new<P: AsRef<str>>(path: P) -> PathResult<Self>

Create a cross-platform path from a string

§Arguments
  • path - The path string to parse
§Errors

Returns PathError if the path is invalid

Source

pub fn with_config<P: AsRef<str>>( path: P, config: PathConfig, ) -> PathResult<Self>

Create path with custom configuration

§Arguments
  • path - The path string to parse
  • config - Custom configuration options
§Errors

Returns PathError if the path is invalid

Source

pub fn to_style(&self, style: PathStyle) -> PathResult<String>

Convert to path string with specified style

§Arguments
  • style - The target path style
§Errors

Returns PathError if conversion fails

Source

pub fn to_platform(&self) -> PathResult<String>

Convert to platform-appropriate path

Automatically detects the current operating system and converts the path to the native format.

§Errors

Returns PathError if conversion fails

Source

pub fn to_windows(&self) -> PathResult<String>

Convert to Windows path

Forces conversion to Windows style (e.g., C:\path\to\file)

§Errors

Returns PathError if conversion fails

Source

pub fn to_unix(&self) -> PathResult<String>

Convert to Unix path

Forces conversion to Unix style (e.g., /mnt/c/path/to/file)

§Errors

Returns PathError if conversion fails

Source

pub fn as_original(&self) -> &Path

Get original path

Source

pub fn set_config(&mut self, config: PathConfig)

Update configuration

Source

pub fn config(&self) -> &PathConfig

Get configuration reference

Source

pub fn is_safe(&self) -> PathResult<bool>

Check if path is safe

Performs security checks including:

  • Path traversal detection
  • Dangerous pattern detection
  • System directory access check
§Errors

Returns PathError if security check fails

Source

pub fn normalize(&mut self) -> PathResult<()>

Normalize path

Removes redundant components like . and ..

§Errors

Returns PathError if normalization fails

Trait Implementations§

Source§

impl Clone for CrossPath

Source§

fn clone(&self) -> CrossPath

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for CrossPath

Source§

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

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

impl<'de> Deserialize<'de> for CrossPath

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&Path> for CrossPath

Source§

fn from(path: &Path) -> Self

Converts to this type from the input type.
Source§

impl From<PathBuf> for CrossPath

Source§

fn from(path: PathBuf) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for CrossPath

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for CrossPath

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for CrossPath

Source§

impl StructuralPartialEq for CrossPath

Auto Trait Implementations§

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 = Infallible

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

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

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,