-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Serialize all enums as externally tagged to guarantee compatibility w…
…ith binary formats such as bincode or postcard
- Loading branch information
1 parent
48ec50a
commit a5e5101
Showing
96 changed files
with
703 additions
and
715 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
#[repr(i8)] | ||
pub enum Ordering { | ||
// @is "$.index[*][?(@.name=='Less')].inner.discriminant.expr" '"-1"' | ||
// @is "$.index[*][?(@.name=='Less')].inner.discriminant.value" '"-1"' | ||
// @is "$.index[*][?(@.name=='Less')].inner.variant.discriminant.expr" '"-1"' | ||
// @is "$.index[*][?(@.name=='Less')].inner.variant.discriminant.value" '"-1"' | ||
Less = -1, | ||
// @is "$.index[*][?(@.name=='Equal')].inner.discriminant.expr" '"0"' | ||
// @is "$.index[*][?(@.name=='Equal')].inner.discriminant.value" '"0"' | ||
// @is "$.index[*][?(@.name=='Equal')].inner.variant.discriminant.expr" '"0"' | ||
// @is "$.index[*][?(@.name=='Equal')].inner.variant.discriminant.value" '"0"' | ||
Equal = 0, | ||
// @is "$.index[*][?(@.name=='Greater')].inner.discriminant.expr" '"1"' | ||
// @is "$.index[*][?(@.name=='Greater')].inner.discriminant.value" '"1"' | ||
// @is "$.index[*][?(@.name=='Greater')].inner.variant.discriminant.expr" '"1"' | ||
// @is "$.index[*][?(@.name=='Greater')].inner.variant.discriminant.value" '"1"' | ||
Greater = 1, | ||
} |
This file contains 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 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
18 changes: 10 additions & 8 deletions
18
tests/rustdoc-json/enums/discriminant/num_underscore_and_suffix.rs
This file contains 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 |
---|---|---|
@@ -1,15 +1,17 @@ | ||
// ignore-tidy-linelength | ||
|
||
#[repr(u32)] | ||
pub enum Foo { | ||
// @is "$.index[*][?(@.name=='Basic')].inner.discriminant.value" '"0"' | ||
// @is "$.index[*][?(@.name=='Basic')].inner.discriminant.expr" '"0"' | ||
// @is "$.index[*][?(@.name=='Basic')].inner.variant.discriminant.value" '"0"' | ||
// @is "$.index[*][?(@.name=='Basic')].inner.variant.discriminant.expr" '"0"' | ||
Basic = 0, | ||
// @is "$.index[*][?(@.name=='Suffix')].inner.discriminant.value" '"10"' | ||
// @is "$.index[*][?(@.name=='Suffix')].inner.discriminant.expr" '"10u32"' | ||
// @is "$.index[*][?(@.name=='Suffix')].inner.variant.discriminant.value" '"10"' | ||
// @is "$.index[*][?(@.name=='Suffix')].inner.variant.discriminant.expr" '"10u32"' | ||
Suffix = 10u32, | ||
// @is "$.index[*][?(@.name=='Underscore')].inner.discriminant.value" '"100"' | ||
// @is "$.index[*][?(@.name=='Underscore')].inner.discriminant.expr" '"1_0_0"' | ||
// @is "$.index[*][?(@.name=='Underscore')].inner.variant.discriminant.value" '"100"' | ||
// @is "$.index[*][?(@.name=='Underscore')].inner.variant.discriminant.expr" '"1_0_0"' | ||
Underscore = 1_0_0, | ||
// @is "$.index[*][?(@.name=='SuffixUnderscore')].inner.discriminant.value" '"1000"' | ||
// @is "$.index[*][?(@.name=='SuffixUnderscore')].inner.discriminant.expr" '"1_0_0_0u32"' | ||
// @is "$.index[*][?(@.name=='SuffixUnderscore')].inner.variant.discriminant.value" '"1000"' | ||
// @is "$.index[*][?(@.name=='SuffixUnderscore')].inner.variant.discriminant.expr" '"1_0_0_0u32"' | ||
SuffixUnderscore = 1_0_0_0u32, | ||
} |
10 changes: 6 additions & 4 deletions
10
tests/rustdoc-json/enums/discriminant/only_some_have_discriminant.rs
This file contains 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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
// ignore-tidy-linelength | ||
|
||
pub enum Foo { | ||
// @is "$.index[*][?(@.name=='Has')].inner.discriminant" '{"expr":"0", "value":"0"}' | ||
// @is "$.index[*][?(@.name=='Has')].inner.variant.discriminant" '{"expr":"0", "value":"0"}' | ||
Has = 0, | ||
// @is "$.index[*][?(@.name=='Doesnt')].inner.discriminant" null | ||
// @is "$.index[*][?(@.name=='Doesnt')].inner.variant.discriminant" null | ||
Doesnt, | ||
// @is "$.index[*][?(@.name=='AlsoDoesnt')].inner.discriminant" null | ||
// @is "$.index[*][?(@.name=='AlsoDoesnt')].inner.variant.discriminant" null | ||
AlsoDoesnt, | ||
// @is "$.index[*][?(@.name=='AlsoHas')].inner.discriminant" '{"expr":"44", "value":"44"}' | ||
// @is "$.index[*][?(@.name=='AlsoHas')].inner.variant.discriminant" '{"expr":"44", "value":"44"}' | ||
AlsoHas = 44, | ||
} |
This file contains 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 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 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 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 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.