dimforge / dimforge/nalgebra

`Dyn` could have `DimName` implemented upstream

Open
#1,431 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.8k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

I'd like to be able to do something to support both static and dynamic allocation on one generic type like below,
```rs
impl ::rand::distributions::Distribution for Mut {
fn sample(...) -> DVector { ... }
}
```

```rs
impl ::rand::distributions::Distribution> for Dirichlet
where
D: Dim + DimName,
nalgebra::DefaultAllocator: nalgebra::allocator::Allocator,
{
fn sample(...) -> OVector { ... }
}
```

but the interface has a problem the second `impl` could duplicate the first if `Dyn` implements `DimName` upstream.

Am I going about this the wrong way, or can I request to seal the `DimName` trait against being implemented on other structs?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.