Skip to content

Commit

Permalink
Add index getter to Variant (#110)
Browse files Browse the repository at this point in the history
* Add index getter to Variant

* Update comment.

* Update release notes and CHANGELOG
  • Loading branch information
ascjones authored Jul 9, 2021
1 parent f8c56b9 commit 749b02f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.9.2] - 2021-07-09
### Added

- Add index getter to Variant [(#110)](https://github.com/paritytech/scale-info/pull/110)

## [0.9.1] - 2021-07-06
### Fixed

- Option constructor macro hygiene [(#108)](https://github.com/paritytech/scale-info/pull/108)

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "scale-info"
version = "0.9.1"
version = "0.9.2"
authors = ["Parity Technologies <[email protected]>"]
edition = "2018"

Expand Down
5 changes: 5 additions & 0 deletions src/ty/variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ where
&self.fields
}

/// Returns the index of the variant, if specified.
pub fn index(&self) -> Option<u8> {
self.index
}

/// Returns the discriminant of the variant.
pub fn discriminant(&self) -> Option<u64> {
self.discriminant
Expand Down

0 comments on commit 749b02f

Please sign in to comment.