Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
9026eee5
Commit
9026eee5
authored
4 years ago
by
Alexander Theißen
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add constant constructor to AccountId32 (#7471)
parent
86d5d960
Branches
gh-readonly-queue/master/pr-6979-88d900afbff7ebe600dfe5e3ee9f87fe52c93d1f
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/primitives/core/src/crypto.rs
+12
-2
12 additions, 2 deletions
substrate/primitives/core/src/crypto.rs
with
12 additions
and
2 deletions
substrate/primitives/core/src/crypto.rs
+
12
−
2
View file @
9026eee5
...
...
@@ -617,6 +617,16 @@ pub trait Public:
#[cfg_attr(feature
=
"std"
,
derive(Hash))]
pub
struct
AccountId32
([
u8
;
32
]);
impl
AccountId32
{
/// Create a new instance from its raw inner byte value.
///
/// Equivalent to this types `From<[u8; 32]>` implementation. For the lack of const
/// support in traits we have this constructor.
pub
const
fn
new
(
inner
:
[
u8
;
32
])
->
Self
{
Self
(
inner
)
}
}
impl
UncheckedFrom
<
crate
::
hash
::
H256
>
for
AccountId32
{
fn
unchecked_from
(
h
:
crate
::
hash
::
H256
)
->
Self
{
AccountId32
(
h
.into
())
...
...
@@ -651,8 +661,8 @@ impl AsMut<[u8; 32]> for AccountId32 {
}
impl
From
<
[
u8
;
32
]
>
for
AccountId32
{
fn
from
(
x
:
[
u8
;
32
])
->
AccountId32
{
AccountId32
(
x
)
fn
from
(
x
:
[
u8
;
32
])
->
Self
{
Self
::
new
(
x
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment