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

Take impl AsRef<Path> instead of PathBuf in credentials APIs #1012

Merged
merged 1 commit into from
Jul 25, 2023

Conversation

paolobarbolini
Copy link
Contributor

I don't know if this is documented anywhere but this is the style used by all APIs that deal with the filesystem. Sometimes it even gets used when a PathBuf would have been the better choice when it comes to heap allocations, because it's nicer to use.

The reason why this is the preferred method is that a bunch of things implement AsRef<Path>, including &str, so it avoids the manual cast to &Path or memcpy to PathBuf.

Copy link
Collaborator

@caspervonb caspervonb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be non-breaking right?

lgtm

@paolobarbolini
Copy link
Contributor Author

Should be non-breaking right?

lgtm

Actually it is

@paolobarbolini
Copy link
Contributor Author

@caspervonb
Copy link
Collaborator

Was hoping there was an .into path there, but regardless I'm for it.

@Jarema
Copy link
Member

Jarema commented Jul 18, 2023

I will merge it after the 0.30.1 patch release.

Copy link
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@Jarema Jarema merged commit 5f26606 into nats-io:main Jul 25, 2023
@Jarema Jarema mentioned this pull request Sep 21, 2023
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.

3 participants