chipsenkbeil / chipsenkbeil/typed-path

Add `.to_std()`

Open
#64 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
69
Forks
15
Avg merge
10h 58m
Merged PRs (30d)
2

Description

This crate is pretty great! ... Until you need to pass the path to `File::open()`...
Could we have a conversion function that convert any path back into an std PathBuf?

For my use case I did a quick hack that is good enough, but I'm not versed in all the filesystem pitfalls that can happen, so an actual proper function would be nice
```rust
use core::str::FromStr;
use std::path::PathBuf;

use typed_path::WindowsPath;

#[extend::ext]
pub impl WindowsPath {
fn to_std(&self) -> PathBuf {
PathBuf::from_str(self.to_str().unwrap()).unwrap()
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the WindowsPath type and its existing string conversion shown in the issue, then compare the expected std::path::PathBuf and File::open usage. Check how typed Unix and Windows paths represent filesystem values, and add focused tests that establish the supported conversion behavior and confirm the resulting path can be used with standard-library APIs.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.