Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Create directory if not exists, and return `Dir`

オープン
#372 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
rust

調査の方向性

まず、既存の Dir::create_dirDir::open_dir および関連するディレクトリ作成 API を確認します。プロジェクトが OpenOptions、既存のディレクトリ、および考えられる TOCTOU の懸念をどのように扱っているかを確認してください。完了時には、ディレクトリを作成または開き、要求されたオプションをサポートし、適切なテストとともに Dir を返す、レビュー済みの API になっているべきです。

索引モデルが issue の本文から書いたものです。

説明

Is there a simple way to create a directory if it does not yet exist and to return the Dir?

Something along the lines of:

async fn create_dir(parent: &Dir, path: &str) -> anyhow::Result<Dir> {
    match parent.create_dir(path) {
        Ok(_) => {}
        Err(e) => match e.kind() {
            std::io::ErrorKind::AlreadyExists => {}
            _ => {
                Err(e)?;
            }
        },
    }
    Ok(parent.open_dir(path).await?) // could maybe be a TOCTOU?
}

I couldn't find a create_dir_with that would allow specifying e.g. OpenOptions, and all the create_dir functions don't return the Dir itself.

If not, would the project be open to contributions on this?

主要言語
Rust
スター
821
フォーク
59
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bytecodealliance/cap-std のほかの issue

bytecodealliance/cap-std の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。