Repository navigation
Basic json module implementation in rust - #89
Merged
Merged
Conversation
Contributor
|
Briljant! This was my idea that this should be relatively easy by using the rust eco system 👍 |
| } | ||
|
|
||
| // Check for Rust-native modules | ||
| if let Some(module) = stdlib::get_modules(vm).get(module) { |
Contributor
There was a problem hiding this comment.
get_modules is now called often, it's return value should be stored in ctx somewhere or in the vm maybe.
| S: serde::Serializer, | ||
| { | ||
| match self { | ||
| PyObjectKind::String { value } => serializer.serialize_str(value), |
Contributor
There was a problem hiding this comment.
Instead of using ObjectKind, use isinstance or alike to check for the type. This allows for subclasses of str, like class MyStr(str) to work as well. We can do this later though..
|
|
||
| fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> | ||
| where | ||
| E: serde::de::Error, |
Contributor
There was a problem hiding this comment.
Okay, this rust code is above my paygrade 😄
This was referenced Aug 26, 2018
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.
This stdlib placement seems OK to me, but if anyone else has an opinion about where we should be placing the Rust parts of our stdlib, I'd be more than happy to follow that.