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

Refactor traits in src/types to use associative types #10

Open
deven96 opened this issue Apr 15, 2022 · 0 comments
Open

Refactor traits in src/types to use associative types #10

deven96 opened this issue Apr 15, 2022 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Extra attention is needed

Comments

@deven96
Copy link
Member

deven96 commented Apr 15, 2022

Instead of

trait Example<T>
where T: Debug {
 fn example(&self) -> T
}

We can use associative types that look cleaner

trait Example {
 type Item: Debug;

 fn example(&self) -> Self::Item
}

Feels a lot cleaner and well defined

@deven96 deven96 added documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Extra attention is needed labels Apr 15, 2022
@deven96 deven96 self-assigned this Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant