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

Use impl Into<T> #71

Open
suprohub opened this issue Aug 12, 2024 · 3 comments
Open

Use impl Into<T> #71

suprohub opened this issue Aug 12, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Milestone

Comments

@suprohub
Copy link

some functions like set_color or set position use multiple arguments, it bit discomfort if you want set position of tuple or Array4.
Solution: position: impl Into<Array4>

@suprohub
Copy link
Author

or use from

@ElhamAryanpur
Copy link
Collaborator

The issue with that is that the function does more than setting just values, it also updates the uniform buffer and transform matrices.

A solution can be to add a whole new copy of the functions that accepts from array/list and internally maps them. But that will add extra confusion and cluttering.

e.g.

// the main
fn set_position(&mut self, x: f32, y: f32, z: f32);

// for array, an extra function can be added
fn set_position_with_array(&mut self, value: impl Into<[f32; 3]>) {
    self.set_position(value[0], value[1], value[2]);
}

@ElhamAryanpur ElhamAryanpur self-assigned this Aug 12, 2024
@ElhamAryanpur ElhamAryanpur added the enhancement New feature or request label Aug 12, 2024
@ElhamAryanpur ElhamAryanpur added this to the 0.6.0 milestone Aug 12, 2024
@ElhamAryanpur ElhamAryanpur added help wanted Extra attention is needed question Further information is requested labels Aug 12, 2024
@ElhamAryanpur
Copy link
Collaborator

@Gipson62 @NickJasonHagen What do you guys think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants