added Endianness access from IFD to python #106
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.
closes #91 No unit tests yet. There were none before me in the Python part. Would be happy to add some with some pointers.
I chose to duplicate the enum in Python, so users can access it as
Endianness.LittleEndian
in Python as well, using pyo3 macro derivation.I added the repr(u16) and custom discriminant on
PyEndianness
for matching tiff structure. I could reflect that in src/reader.rs::Endianness
or drop completely.It seems that
FromPyObject
trait impl is needed if we want to pass it into a rust function from the python side. Since we don't currently do that, I didn't implement it. Could be nicely done to accept all ofEndianness
,u16
orString
I think?I'm a bit unsure of the location of
PyEndianness
Since its an enum I put it in python/src/enums.rs
, even though all enums there are tags. On the rust sideEndianness
is inreader.rs
, which makes sense implementation-wise I think? Should it actually be inpython/src/reader.rs
? Or should we wait for repo layout (#69).