Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[draft] Add borrowing for fs_utf8::Dir #361

Closed
wants to merge 1 commit into from

Conversation

cgwalters
Copy link
Contributor

I'd like to start using fs_utf8::Dir, but not in a "big bang" fashion where I wholesale convert the entire codebase. It feels normal and natural to have a non-utf8 Dir instance and maybe sometimes just want to "view" it as utf8.

At an efficiency level, having to create a new owned fd for this feels unnecessary.

This sketches out an implementation where we can also support borrowing an existing fd.

This doesn't compile, but before I do a lot more typing on this - consider it an RFC. Is this a good direction?

I'd like to start using `fs_utf8::Dir`, but not in a "big bang"
fashion where I wholesale convert the entire codebase. It feels
normal and natural to have a non-utf8 `Dir` instance and
maybe sometimes just want to "view" it as utf8.

At an efficiency level, having to create a new owned fd for
this feels unnecessary.

This sketches out an implementation where we can also support
borrowing an existing fd.

This doesn't compile, but before I do a lot more typing on
this - consider it an RFC. Is this a good direction?
@cgwalters
Copy link
Contributor Author

Oh yeah, I guess things like

#[cfg(not(windows))]
impl From<Dir> for OwnedFd {
    #[inline]
    fn from(dir: Dir) -> OwnedFd {
        dir.cap_std.into()
    }
}

can't work anymore...ugh, would need a new BorrowedDir or something.

@cgwalters cgwalters closed this Jul 11, 2024
@cgwalters
Copy link
Contributor Author

OK, trying #362 instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant