achanda / ipnetwork

A library to work with CIDRs in rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Split up growing library

faern opened this issue · comments

The main file, lib.rs is growing quite large. A lot of IPv4 and IPv6 stuff is more or less interleaved. I think this library would benefit from being split up into smaller files. Do you agree @achanda ?

If so, how do we do this? Simplest solution would be to just create ipv4.rs and ipv6.rs and move the respective code (and tests) into those. How about the common stuff? Some stuff is shared between the two versions and the more code they can share the better. Just put it in a common.rs? lib.rs can just reexport everything so the public API is the same as today.

I can start working on this, but I want to discuss what you think first.

Yeah, this is definitely something that needs to be done. I agree with the split too, two files for v4 and v6 and one for common code, and lib.rs.

👍 Then I'll start that as soon as I have time!