Repository navigation
Read, set and make objects bound to Rust without Python - #24
Merged
Merged
Conversation
…rs and a __new__ of the extension's own
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The Rust extension now has the
__fields__and__maker__which one of C++ has, in each of its modules: so a field is read and set, and an object made, by the extension itself. The Python runtime is unchanged, as it binds either alike.Fieldis the descriptor, which the generated code gives what reads and writes the field of a struct.makergives a class its__new__.Sharedobject, a union.Nativeby one implementation of the crate's, not one generated for each.frombufferis found once, not for each array which is read.On an Apple M1, of extensions built for release, in nanoseconds:
Money(1.5, Currency.EUR)Trade, of 19 fieldsThe README's Performance section has these, with a column for Rust read and set by Python's descriptors, as it has for C++.
Tested as the descriptors of C++ are: by the tests which are for every mode, and by the same script of what a descriptor does, with the extension's own and with Python's in their place.
Of what Rust is yet to do, this leaves msgpack, JSON and Arrow, and an example built with maturin.