-
Notifications
You must be signed in to change notification settings - Fork 283
Rework structured value casting #396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
0459fd0
capture primitives in from_debug and from_display calls
KodrAus be90b6e
experiment with different strategies for lookups
KodrAus ef5778b
wire up build-time type id sorting
KodrAus 75211b5
refactor type id generation to encapsulate details
KodrAus dac6e30
remove dead code
KodrAus 1f59a35
refactor casting a bit and fix sval
KodrAus 7af0cf1
shift some docs
KodrAus c00c8aa
explicit From impls for dyn traits
KodrAus 690ae53
remove junk file
KodrAus dd15f5b
remove an invalid ;
KodrAus 256b962
const works out the same as static
KodrAus fd2049a
remove 'static bounds where unneeded
KodrAus c8a3d37
add const version
KodrAus f9333fb
add specialization-based conversion
KodrAus 751ea85
add some notes about Value construction
KodrAus b265bdc
add a from_any method to avoid trait imports
KodrAus a022108
remove implied Sized bound
KodrAus 117b7a8
tidy up type id checking
KodrAus d0f6561
flesh out const eval based conversions
KodrAus 34d4a49
Merge branch 'master' of https://github.com/rust-lang/log into fix/va…
KodrAus 52ddb2e
get doc tests to pass
KodrAus 84a3a7b
run fmt
KodrAus 0628fe6
remove unneeded unstable attribute
KodrAus 023e7e5
const type ids needs 1.47
KodrAus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #![cfg(feature = "kv_unstable")] | ||
| #![feature(test)] | ||
|
|
||
| extern crate test; | ||
| extern crate log; | ||
|
|
||
| use log::kv::Value; | ||
|
|
||
| #[bench] | ||
| fn u8_to_value(b: &mut test::Bencher) { | ||
| b.iter(|| { | ||
| Value::from(1u8) | ||
| }) | ||
| } | ||
|
|
||
| #[bench] | ||
| fn u8_to_value_debug(b: &mut test::Bencher) { | ||
| b.iter(|| { | ||
| Value::from_debug(&1u8) | ||
| }) | ||
| } | ||
|
|
||
| #[bench] | ||
| fn str_to_value_debug(b: &mut test::Bencher) { | ||
| b.iter(|| { | ||
| Value::from_debug(&"a string") | ||
| }) | ||
| } | ||
|
|
||
| #[bench] | ||
| fn custom_to_value_debug(b: &mut test::Bencher) { | ||
| #[derive(Debug)] | ||
| struct A; | ||
|
|
||
| b.iter(|| { | ||
| Value::from_debug(&A) | ||
| }) | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,12 +3,21 @@ | |
|
|
||
| use std::env; | ||
|
|
||
| #[cfg(feature = "kv_unstable")] | ||
| #[path = "src/kv/value/internal/cast/primitive.rs"] | ||
| mod primitive; | ||
|
|
||
| fn main() { | ||
| let target = env::var("TARGET").unwrap(); | ||
|
|
||
| if !target.starts_with("thumbv6") { | ||
| println!("cargo:rustc-cfg=atomic_cas"); | ||
| } | ||
|
|
||
| #[cfg(feature = "kv_unstable")] | ||
| primitive::generate(); | ||
|
|
||
| println!("cargo:rustc-cfg=src_build"); | ||
|
||
|
|
||
| println!("cargo:rerun-if-changed=build.rs"); | ||
| } | ||
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just testing different strategies for destructuring.