1
- use anyhow:: Error ;
2
1
use graph:: impl_slog_value;
3
2
use std:: cmp:: Ordering ;
4
- use std:: collections:: BTreeSet ;
5
3
use std:: fmt;
6
- use std:: str:: FromStr ;
7
4
8
5
use crate :: DataSource ;
9
6
@@ -17,7 +14,7 @@ pub struct NodeCapabilities {
17
14
/// other. No [`Ord`] (i.e. total order) implementation is applicable.
18
15
impl PartialOrd for NodeCapabilities {
19
16
fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
20
- product_order ( [
17
+ product_order ( & [
21
18
self . archive . cmp ( & other. archive ) ,
22
19
self . traces . cmp ( & other. traces ) ,
23
20
] )
@@ -26,7 +23,7 @@ impl PartialOrd for NodeCapabilities {
26
23
27
24
/// Defines a [product order](https://en.wikipedia.org/wiki/Product_order) over
28
25
/// an array of [`Ordering`].
29
- fn product_order < const N : usize > ( cmps : [ Ordering ; N ] ) -> Option < Ordering > {
26
+ fn product_order ( cmps : & [ Ordering ] ) -> Option < Ordering > {
30
27
if cmps. iter ( ) . all ( |c| c. is_eq ( ) ) {
31
28
Some ( Ordering :: Equal )
32
29
} else if cmps. iter ( ) . all ( |c| c. is_le ( ) ) {
@@ -38,18 +35,6 @@ fn product_order<const N: usize>(cmps: [Ordering; N]) -> Option<Ordering> {
38
35
}
39
36
}
40
37
41
- impl FromStr for NodeCapabilities {
42
- type Err = Error ;
43
-
44
- fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
45
- let capabilities: BTreeSet < & str > = s. split ( ',' ) . collect ( ) ;
46
- Ok ( NodeCapabilities {
47
- archive : capabilities. contains ( "archive" ) ,
48
- traces : capabilities. contains ( "traces" ) ,
49
- } )
50
- }
51
- }
52
-
53
38
impl fmt:: Display for NodeCapabilities {
54
39
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
55
40
let NodeCapabilities { archive, traces } = self ;
0 commit comments