Use references for scalar operands

Aberta
#1,200 1 comentário 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
35/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
rust
Domínio
data

Direção de pesquisa

Start by tracing the ops macros and the ScalarOperand and StaticOperand implementations mentioned in the issue, then reproduce the array-plus-referenced-scalar example. Investigate the conflicting implementation error and existing operand combinations. Done means the example compiles while existing array operation behavior remains supported.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

It would be useful for me to be able to use references to scalars instead of owned instances when performing operations on arrays.

e.g., this fails:

let arr1 = array!([1, 2, 3]);
let four: i32 = 4;
let arr2 = arr1 + &four; //error

I naively tried modifying the ops macros to accept references but kept getting a conflicting implementation error. It seems that the compiler is worried that someone will come along an add an implementation to StaticOperand for reference types:

    = note: downstream crates may implement trait `impl_ops::ScalarOperand` for type `&_`

...which is strange because there's a 'static type bound on ScalarOperand?

In any case, if anyone has any guidance on how to proceed, I'd greatly appreciate it! I'm happy to open a PR with a nudge in the right direction.

Linguagem predominante
Rust
Estrelas
4.3k
Forks
391
Métricas de merge de PRs
Nenhum PR com merge em 30d

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de rust-ndarray/ndarray

Todas as issues de rust-ndarray/ndarray

Issues semelhantes

Mais issues de Rust

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.