jmespath / jmespath.rs

Rust implementation of JMESPath, a query language for JSON
MIT License
133 stars 26 forks source link

Allow usage with stable Rust #19

Closed caspark closed 7 years ago

caspark commented 7 years ago

The meat of this change is putting the usage of specialization behind a specialized feature flag, such that on stable Rust this library always uses impl<'a, T: ser::Serialize> ToJmespath for T.

After I did that, I needed to tweak some of the imports, as (for reasons I don't quite understand) nightly Rust treats imports slightly differently than stable Rust does.

Benchmarks (on rustc 1.16.0-nightly (6f1ae663e 2017-01-06)) show the version without specialization is between 2-10x slower.

But I'd rather have code running 2-10x slower than not be able to use the functionality at all in my project :)

caspark commented 7 years ago

Seems like I've managed to wrangle the Travis CI config to test both with the specialized feature switched on and off on nightly while stable and beta trains of Rust have the feature switched off.

Depending on your inclinations, you might want to tweak things a little further to make sure the feature is on for calculating code coverage or similar, and I suspect that deploy_gh_pages.sh also needs a check to make sure the docs are only published from (I suggest) the stable Rust build job.

mtdowling commented 7 years ago

Awesome! Thanks for doing this! I'm glad to see that specialization is actually helping out quite a bit here.

I've been thinking about just moving the docs for this crate over to docs.rs anyways, so now seems like a good time to do that :)

caspark commented 7 years ago

Great! Thanks for the quick review & merge. Once you've got the docs publishing sorted out, would you push up a release to crates.io please?

mtdowling commented 7 years ago

Everything should all be sorted out now, and I pushed up 0.1.1 to crates.io: https://crates.io/crates/jmespath/0.1.1

caspark commented 7 years ago

Great, thank you!