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
6e645915
Verified
Commit
6e645915
authored
1 month ago
by
Michal Kucharczyk
Browse files
Options
Downloads
Patches
Plain Diff
BlockAndNumber: Ord, Eq, PartialOrd, PartialEq implemented
parent
67279ecf
No related merge requests found
Pipeline
#515929
waiting for manual action with stages
in 10 minutes and 35 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/primitives/blockchain/src/header_metadata.rs
+23
-0
23 additions, 0 deletions
substrate/primitives/blockchain/src/header_metadata.rs
with
23 additions
and
0 deletions
substrate/primitives/blockchain/src/header_metadata.rs
+
23
−
0
View file @
6e645915
...
@@ -153,6 +153,29 @@ pub struct HashAndNumber<Block: BlockT> {
...
@@ -153,6 +153,29 @@ pub struct HashAndNumber<Block: BlockT> {
pub
hash
:
Block
::
Hash
,
pub
hash
:
Block
::
Hash
,
}
}
impl
<
Block
:
BlockT
>
Eq
for
HashAndNumber
<
Block
>
{}
impl
<
Block
:
BlockT
>
PartialEq
for
HashAndNumber
<
Block
>
{
fn
eq
(
&
self
,
other
:
&
Self
)
->
bool
{
self
.number
.eq
(
&
other
.number
)
&&
self
.hash
.eq
(
&
other
.hash
)
}
}
impl
<
Block
:
BlockT
>
Ord
for
HashAndNumber
<
Block
>
{
fn
cmp
(
&
self
,
other
:
&
Self
)
->
std
::
cmp
::
Ordering
{
match
self
.number
.cmp
(
&
other
.number
)
{
std
::
cmp
::
Ordering
::
Equal
=>
self
.hash
.cmp
(
&
other
.hash
),
result
=>
result
,
}
}
}
impl
<
Block
:
BlockT
>
PartialOrd
for
HashAndNumber
<
Block
>
{
fn
partial_cmp
(
&
self
,
other
:
&
Self
)
->
Option
<
std
::
cmp
::
Ordering
>
{
Some
(
self
.cmp
(
&
other
))
}
}
/// A tree-route from one block to another in the chain.
/// A tree-route from one block to another in the chain.
///
///
/// All blocks prior to the pivot in the vector is the reverse-order unique ancestry
/// All blocks prior to the pivot in the vector is the reverse-order unique ancestry
...
...
This diff is collapsed.
Click to expand it.
Michal Kucharczyk
@michalkucharczyk
mentioned in commit
5f6c8e8f
·
1 month ago
mentioned in commit
5f6c8e8f
mentioned in commit 5f6c8e8fd20f19de0b592ef2413e934e97c9bc68
Toggle commit list
Michal Kucharczyk
@michalkucharczyk
mentioned in commit
917470b8
·
1 month ago
mentioned in commit
917470b8
mentioned in commit 917470b805cfc7d522a208abfbe7f55994fd6c9e
Toggle commit list
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