Add docs on how to write a function for both owned arrays and views

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
rust
領域
documentation

調査の方向性

Review the existing ndarray documentation and the linked Stack Overflow example first. Determine the recommended way to write a function accepting both owned arrays and views, then document that pattern with a comparable example and make the guidance clear for both cases.

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

説明

docs

I'm currently trying to write a function that can take either an owned array or a view. I'm currently relying on this stackoverflow post to do something like:

use ndarray::{ArrayBase, RawData, s, array, Ix1};

fn do_something_with_array<S>(a: &ArrayBase<S, Ix1>) where S: RawData{

}

fn main () {
    let a = array![1, 2, 3];
    do_something_with_array(&a);

    let slc = a.slice(s![1..3]);
    do_something_with_array(&slc);
}

I'm not sure if this is the best way though (certainly having to include a type parameter in the function definition seems clunky), so it would be good to get clarification and add a section to the docs explaining how to write these functions.

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

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

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

rust-ndarray/ndarray のほかの issue

rust-ndarray/ndarray の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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