wokket / rust-hl7

Learning rust by playing with a HL7 parser. Use for real at your own risk!
18 stars 8 forks source link

Discussion: Simplify module structure #25

Closed wokket closed 3 years ago

wokket commented 3 years ago

The current deep module structure made sense when I was considering having many variants of each struct to handle the different scenarios (repeating/non-repeating, componentised etc etc) but is really just annoying when trying to work with library due to the large number of use statements required.

It would be a breaking change, but I'm tempted to move the core structs (Message, Segment, Field, Separators) into either the top level module, or a core module for simplicity.

sempervictus commented 3 years ago

Personally i dont really see the benefit of such structural changes to top-level as libraries grow over time, and eventually we'll end up back here but with more files. Most users of the lib probably won't care about inner structure - unless you're down with the sickness in the worst way, you're probably just doing field extractions and the like and only use rusthl7::message::Message

wokket commented 3 years ago

Good feedback, ta. I thought you were also using the various Segment types etc for direct querying?

sempervictus commented 3 years ago

Is there anything left to do on this issue?

wokket commented 3 years ago

I'm still hoping to get these all moved into a top-level namespace to simplify the usings rather than having single-entity modules everywhere, see https://github.com/wokket/rust-hl7/blob/master/examples/demo.rs#L6

sempervictus commented 3 years ago

All for.. how do we do that without cramming them into the same file?

wokket commented 3 years ago

https://doc.rust-lang.org/book/ch07-05-separating-modules-into-different-files.html