Add writing and streaming capabilities #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some enhancements that I needed for my project that I would like to share. I should have split this into 2 PRs but one thing lead to another while developing.
Create ILDA files from low level frames or animations. This should be pretty much self explanatory.
As for the interface, an object that has the
Write
trait is needed. The implementation also takes care about writing the last finishing header automatically or pragmatically. I am using a method that I mimicked from the https://github.com/ruuda/hound crate.As discussed in an issue earlier, I needed streaming capability for my project. I am basically creating never ending ILDA files on the fly that I would like to read/write.
For the interface I provide an Iterator over ILDA frames from objects that have
Read
implemented. This seemed most logical given the widespread use ofRead
/Write
andIterator
in general.You can choose from 2 iterators, one that yields
Result<IldaEntry, IldaError>
and an easier to use version that only yieldsIldaEntry
but may panic.To achieve the above, I did some refactoring, mainly in the way how to handle and yield read new frames (both in parser and animation). There are some small interface changes, so I guess it would be best to raise the library version up to 0.3.