mastodon.cardina1.red は、数々の独立したMastodonサーバーのうちのひとつです。サーバーに登録してFediverseのコミュニティに加わってみませんか。

サーバーの情報

3
人のアクティブユーザー

generators 欲しいと思ったこと正直そんなにないんだけど、 GAT (Generic Associated Types) は滅茶苦茶欲しいですね……はやく安定化されないかな

🔬 Tracking issue for generic associated types (GAT) · Issue #44265 · rust-lang/rust
github.com/rust-lang/rust/issu

associated types をジェネリックにして型パラメータとかライフタイムパラメータを付けられるようになるやつで、「参照のイテレータを返す関数を持つトレイトに、返されるイテレータの型を関連型として持たせたい」みたいな場合に必要になる (メソッドの &self のライフタイムをイテレータ型が受け継ぐ必要があるため)

github.com🔬 Tracking issue for generic associated types (GAT) · Issue #44265 · rust-lang/rustThis is a tracking issue for generic associated types (rust-lang/rfcs#1598) Unresolved questions: #87479 -- defaults for where Self: 'a Blocking bugs #62521 #30472 No longer blocking #67509 #67...
らりお・ザ・何らかの🈗然㊌ソムリエ

trait Items {
type Iter<'a>;
fn items<'a>(&'a self) -> Self::Iter<'a>;
}

impl<T> Items for Vec<T> {
type Iter<'a> = core::slice::Iter<'a, T>;
type items<'a>(&'a self) -> Self::Iter<'a> {
self.iter()
}
}

みたいなことができるようになる