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

Parsing an entire IGC file #29

Open
dbrgn opened this issue Apr 21, 2019 · 2 comments
Open

Parsing an entire IGC file #29

dbrgn opened this issue Apr 21, 2019 · 2 comments

Comments

@dbrgn
Copy link
Contributor

dbrgn commented Apr 21, 2019

The docs state:

This crate provides a minimal, fast parser for IGC files.

But from the docs, it also seems that it only provides a line/record parser. Or did I overlook something?

I'm aware that I can parse a file by mapping the parsing function on a line iterator, but it would be cool if there were a function to do that in this library (e.g. a parser that can process any type that implements std::io::Read). What do you think?

@Turbo87
Copy link
Contributor

Turbo87 commented Apr 22, 2019

it is certainly possible to build a parser on top of this library that implements that, but I'm not sure if igc-rs should provide that by itself. we currently use lifetime annotations in a lot of places to avoid unnecessary memory copies, but when parsing a whole life that gets a lot more tricky. you would need to read the whole file in memory first, but then the advantage of std::io::Read is gone.

a parser that reads complete files also might want to task the I/J records into account a little better than what we do here so far, and couldn't be stateless due to that.

@dbrgn
Copy link
Contributor Author

dbrgn commented Apr 22, 2019

That's true, and I only realized the difficulty with the lifetimes once I ran into that myself 🙂

Maybe the goal of the library should be re-worded to "This crate provides a minimal, fast parser for IGC records".

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

No branches or pull requests

2 participants