Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: multiple one found #465

Open
jcyongqin opened this issue Aug 2, 2018 · 3 comments
Open

error: multiple one found #465

jcyongqin opened this issue Aug 2, 2018 · 3 comments

Comments

@jcyongqin
Copy link

error[E0034]: multiple applicable items in scope
--> hello_gl\src\main.rs:29:16
|
29 | let tran = Matrix4::one();
| ^^^^^^^^^^^^ multiple one found
|
= note: candidate #1 is defined in an impl of the trait cgmath::One for the type cgmath::Matrix4<_>
= note: candidate #2 is defined in an impl of the trait cgmath::Transform for the type cgmath::Matrix4<_>

code:

use cgmath::prelude::*;
use cgmath::{Vector4, Matrix4};

    let vec = m::vec3::<f32>(1.0, 0.0, 0.0);
    let tran = Matrix4::<f32>::one();
    let vec = tran.transform_vector(vec);
    println!("{:?}", &vec);
@Rhuagh
Copy link

Rhuagh commented Sep 14, 2018

What would be the best way to resolve this, remove ::one() from Transform?

@kvark
Copy link
Collaborator

kvark commented Sep 14, 2018

Given that there is One trait, we should rename Transform::one to something more unique. identity() is already provided for SquareMatrix trait, which would conflict with Transform for matrices... Maybe Transform should just derive from One and re-use it's one() method instead of adding one for itself? There appears to be quite an overlap between traits (speaking of #419 ...).

@faulesocke
Copy link

I would suggest making Transform depend on One and then removing the one() method from Transform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants