File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 7
7
* Fix a bug in multi-patterns where static patterns are interpreted as regex. [ #366 ]
8
8
* Introduce ` ResourceDef::pattern_iter ` to get an iterator over all patterns in a multi-pattern resource. [ #373 ]
9
9
* Fix segment interpolation leaving ` Path ` in unintended state after matching. [ #368 ]
10
- * Fix ` ResourceDef ` ` PartialEq ` implementation.
10
+ * Fix ` ResourceDef ` ` PartialEq ` implementation. [ # 373 ]
11
11
* Re-work ` IntoPatterns ` trait, adding a ` Patterns ` enum. [ #372 ]
12
12
* Implement ` IntoPatterns ` for ` bytestring::ByteString ` . [ #372 ]
13
13
* Rename ` Path::{len => segment_count} ` to be more descriptive of it's purpose. [ #370 ]
Original file line number Diff line number Diff line change @@ -49,6 +49,15 @@ pub enum Patterns {
49
49
List ( Vec < String > ) ,
50
50
}
51
51
52
+ impl Patterns {
53
+ pub fn is_empty ( & self ) -> bool {
54
+ match self {
55
+ Patterns :: Single ( _) => false ,
56
+ Patterns :: List ( pats) => pats. is_empty ( ) ,
57
+ }
58
+ }
59
+ }
60
+
52
61
/// Helper trait for type that could be converted to one or more path pattern.
53
62
pub trait IntoPatterns {
54
63
fn patterns ( & self ) -> Patterns ;
@@ -78,6 +87,12 @@ impl IntoPatterns for bytestring::ByteString {
78
87
}
79
88
}
80
89
90
+ impl IntoPatterns for Patterns {
91
+ fn patterns ( & self ) -> Patterns {
92
+ self . clone ( )
93
+ }
94
+ }
95
+
81
96
impl < T : AsRef < str > > IntoPatterns for Vec < T > {
82
97
fn patterns ( & self ) -> Patterns {
83
98
let mut patterns = self . iter ( ) . map ( |v| v. as_ref ( ) . to_owned ( ) ) ;
You can’t perform that action at this time.
0 commit comments