[go: up one dir, main page]

canonicalize_as_string

Function canonicalize_as_string 

Source
pub fn canonicalize_as_string<T: AsPath + ?Sized>(
    path: &T,
) -> FsIOResult<String>
Expand description

Returns a canonicalized string from the provided path value.

§Arguments

  • path - The path value

§Example

use fsio::path;
use fsio::path::as_path::AsPath;
use std::path::Path;

fn main() {
    let path_obj = Path::new("./src/path/mod.rs");

    let path1 = path::canonicalize_as_string(&path_obj);
    let path2 = path::canonicalize_as_string(&"./src/path/mod.rs".to_string());

    assert_eq!(path1.unwrap(), path2.unwrap());
}