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

impl AsIpv4Addrs refactoring #23

Merged
merged 2 commits into from
May 17, 2022
Merged

impl AsIpv4Addrs refactoring #23

merged 2 commits into from
May 17, 2022

Conversation

keepsimple1
Copy link
Owner

@keepsimple1 keepsimple1 commented May 17, 2022

When trying to use the latest code in main, I found that it missed impl AsIpv4Addrs trait for &String, which I used with previous versions.

To support AsIpv4Addrs with reference types and avoid redundancy, this diff changes the rest of impls to use reference types.

This is a follow-up to PR #21 . @indietyp any comments/thoughts?

@indietyp
Copy link
Contributor

I must've deleted the implementation, but there was an original implementation. (f2627ac#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R1370)

Tho, it would have been:

impl<T: AsIpv4Addrs> for &T {
    fn as_ipv4_addrs(&self) {
       T::as_ipv4_addrs(self)
    }
}

or something similar.

@indietyp
Copy link
Contributor

this would enable usage for owned and borrowed types

@indietyp
Copy link
Contributor

I just checked, I must've removed the implementation by accident in 70443c12309a5c0e014696f9a0795dfcffea038d.

@keepsimple1
Copy link
Owner Author

Thanks for bringing that up. That's a better approach! I updated the diff.

@keepsimple1 keepsimple1 merged commit 7c53e87 into main May 17, 2022
@keepsimple1 keepsimple1 deleted the fix-trait branch May 17, 2022 20:10
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

Successfully merging this pull request may close these issues.

2 participants