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

TypedPathBuf::parent documentation indicates it returns TypedPathBuf instead of TypedPath #44

Open
rutrum opened this issue Jan 18, 2025 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@rutrum
Copy link

rutrum commented Jan 18, 2025

https://docs.rs/typed-path/0.10.0/src/typed_path/typed/non_utf8/pathbuf.rs.html#549

The documentation says that the parent method returns TypedPathBuf, but it actually returns a TypedPath.

Aside from the documentation mismatch, do you know if there is a way to take &TypedPathBuf and get the parent as another TypedPathBuf?

@chipsenkbeil
Copy link
Owner

chipsenkbeil commented Jan 18, 2025

If you want another TypedPathBuf, you can convert the TypedPath to one.

path.parent().to_path_buf()

Alternatively, if you are okay mutating your existing TypedPathBuf, you can pop to get the parent.

path.pop();

// now it's the parent

@chipsenkbeil chipsenkbeil changed the title TypedPathBuf::parent returns TypedPath TypedPathBuf::parent documentation indicates it returns TypedPathBuf instead of TypedPath Jan 22, 2025
@chipsenkbeil chipsenkbeil changed the title TypedPathBuf::parent documentation indicates it returns TypedPathBuf instead of TypedPath TypedPathBuf::parent documentation indicates it returns TypedPathBuf instead of TypedPath Jan 22, 2025
@chipsenkbeil chipsenkbeil added the documentation Improvements or additions to documentation label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants