Getting the path of a Dir
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- rust
調査の方向性
まず、既存の cap-std の Dir API と cap-directories の ProjectDirs メソッドを確認し、次に提案された wrapper がパスをどのように追跡するかを調べます。完了条件は、合意された API と capability-model に関する警告の文書化です。この issue では、更新するファイルやテストは指定されていません。
索引モデルが issue の本文から書いたものです。
説明
Sometimes I'd like to be able to get the path for a Dir.
For example,
- logs or debugging
- passing the path to a separate process
- passing the path to a library that doesn't yet support the capability model
For example, in a personal project, I'm using the git2 wrapper around libgit2. In order to call Repository::clone(url, path), I need the path of the cache directory. I could use gitoxide, a pure rust implementation of git, however that would have the same problem. Maybe in the future we can make gitoxide use cap-std, but for now that's not an option.
Yes, some of these examples break the capability model, however, from a pragmatic point of view, that may be acceptable.
I'm not sure what the best approach here is, but in my personal project I'm using a wrapper like
pub struct DirWithPath {
dir: Dir,
path: PathBuf,
}
with a constructor like
pub fn open_ambient_dir<P: AsRef<Path>>(path: P, ambient_authority: AmbientAuthority) -> io::Result<Self> {
Dir::open_ambient_dir(path.as_ref(), ambient_authority).map(|dir| Self {
dir,
path: path.as_ref().to_path_buf(),
})
}
and an open_dir method that concatenates the path:
pub fn open_dir<P: AsRef<Path>>(self: &Self, path: P) -> io::Result<Self> {
let full_path = self.path.join(path.as_ref());
self.dir.open_dir(path).map(|dir| Self {
dir,
path: full_path,
})
}
One issue with maintaining my own wrapper is that I can't use e.g ProjectDirs from cap-directories because its methods return Dirs, so the paths are unknown. I would have to wrap directories_next directly.
I wonder if it would be useful for other people if something like this was added to cap-std (with appropriate warnings with respect to it breaking the capability model)?
- 主要言語
- Rust
- スター
- 821
- フォーク
- 59
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bytecodealliance/cap-std のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
bytecodealliance/cap-std#427 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
bytecodealliance/cap-std#416 · コメント 2 件 ·
-
Archiving cap-stdオープン
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
bytecodealliance/cap-std#426 · コメント 2 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
bytecodealliance/cap-std#423 · コメント 5 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 42/100
bytecodealliance/cap-std#408 · コメント 4 件 · リアクション 2 件 ·
bytecodealliance/cap-std の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
arkworks-rs/algebra#1161 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
lbjlaq/Antigravity-Manager#3525 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
agent-ready area:platform bug criticality:p3 rust triage:needs-implementation
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
registrystack/registry-stack#1583 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
Docs: "Work with Codex from anywhere" page still claims Windows mobile support is "coming soon"オープンapp documentation remote windows-os
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信