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

Splitting src/iface/interface.rs into multiple files #522

Closed
thvdveld opened this issue Aug 19, 2021 · 2 comments
Closed

Splitting src/iface/interface.rs into multiple files #522

thvdveld opened this issue Aug 19, 2021 · 2 comments

Comments

@thvdveld
Copy link
Contributor

I was thinking of splitting the implementations of Interface, InterfaceBuilder and InterfaceInner into multiple files, where each file implements for a specific medium. I was working on the IEEE802.15.4 and 6LoWPAN protocol and I found that the src/iface/interface.rs was getting big with things that where sometimes unrelated. What do you think about this change?

But then again, I'm not sure if this is the best way to go as well, since, for example, lookup_hardware_addr is needed for Ethernet and IEEE802.15.4.

@Dirbaio
Copy link
Member

Dirbaio commented Sep 8, 2021

I did an attempt at splitting multiple mediums in multiple structs in #336 and it went really badly. Interface is really complex and Ethernet/IP aren't really independent of each other, so you can't simply split them like that. It was an uphill battle against the borrow checker :)

What might work is splitting them in multiple files, but still being impls on the same Interface struct. It's a mostly "cosmetic" improvement though, everything is still a megastruct, but it could still be worth it.

@thvdveld
Copy link
Contributor Author

thvdveld commented Sep 9, 2021

What might work is splitting them in multiple files, but still being impls on the same Interface struct. It's a mostly "cosmetic" improvement though, everything is still a megastruct, but it could still be worth it.

I tried doing that as well and agree that it's very "cosmetic" and even worse than everything in one file. I'll close this issue then.

@thvdveld thvdveld closed this as completed Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants