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

add an useful File::append() utility #134755

Closed
liigo opened this issue Dec 25, 2024 · 3 comments
Closed

add an useful File::append() utility #134755

liigo opened this issue Dec 25, 2024 · 3 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@liigo
Copy link
Contributor

liigo commented Dec 25, 2024

// open an existing or create a new file for append data.
// very useful when writing log files.

pub fn append<P: AsRef<Path>>(path: P) -> io::Result<File> {
    OpenOptions::new().append(true).create(true).open(path.as_ref())
}
  • open_append() doesn't make sense, since it maybe creates new file
  • create_append() doesn't make sense, since it maybe open existing file

Since we‘re adding open_buffered and create_buffered, I think we also have a chance to add File::append. File::options().append(true).create(true).open(path.as_ref()) is too long and requires thinking more on flags in detail.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 25, 2024
@jieyouxu
Copy link
Member

Hi @liigo thanks for the feature request. This is an API request, so you should instead open an API Change Proposal (ACP) at https://github.com/rust-lang/libs-team/issues.

@jieyouxu jieyouxu added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-feature-request Category: A feature request, i.e: not implemented / a PR. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Dec 25, 2024
@liigo
Copy link
Contributor Author

liigo commented Dec 26, 2024

@jieyouxu ACP link: rust-lang/libs-team#512

@jieyouxu
Copy link
Member

Thanks! I'm going to close this issue on the rust-lang/rust side in favor of rust-lang/libs-team#512, since this is not actionable for this issue tracker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants