11use std:: borrow:: Cow ;
22
3- #[ cfg( not( target_os = "wasi" ) ) ]
43use crate :: browser:: BrowserHistory ;
5- #[ cfg( not( target_os = "wasi" ) ) ]
64use crate :: hash:: HashHistory ;
75use crate :: history:: History ;
86use crate :: listener:: HistoryListener ;
@@ -15,10 +13,8 @@ use crate::{error::HistoryResult, query::ToQuery};
1513#[ derive( Clone , PartialEq , Debug ) ]
1614pub enum AnyHistory {
1715 /// A Browser History.
18- #[ cfg( not( target_os = "wasi" ) ) ]
1916 Browser ( BrowserHistory ) ,
2017 /// A Hash History
21- #[ cfg( not( target_os = "wasi" ) ) ]
2218 Hash ( HashHistory ) ,
2319 /// A Memory History
2420 Memory ( MemoryHistory ) ,
@@ -27,39 +23,35 @@ pub enum AnyHistory {
2723impl History for AnyHistory {
2824 fn len ( & self ) -> usize {
2925 match self {
30- #[ cfg( not( target_os = "wasi" ) ) ]
3126 Self :: Browser ( m) => m. len ( ) ,
32- # [ cfg ( not ( target_os = "wasi" ) ) ]
27+
3328 Self :: Hash ( m) => m. len ( ) ,
3429 Self :: Memory ( m) => m. len ( ) ,
3530 }
3631 }
3732
3833 fn go ( & self , delta : isize ) {
3934 match self {
40- #[ cfg( not( target_os = "wasi" ) ) ]
4135 Self :: Browser ( m) => m. go ( delta) ,
42- # [ cfg ( not ( target_os = "wasi" ) ) ]
36+
4337 Self :: Hash ( m) => m. go ( delta) ,
4438 Self :: Memory ( m) => m. go ( delta) ,
4539 }
4640 }
4741
4842 fn push < ' a > ( & self , route : impl Into < Cow < ' a , str > > ) {
4943 match self {
50- #[ cfg( not( target_os = "wasi" ) ) ]
5144 Self :: Browser ( m) => m. push ( route) ,
52- # [ cfg ( not ( target_os = "wasi" ) ) ]
45+
5346 Self :: Hash ( m) => m. push ( route) ,
5447 Self :: Memory ( m) => m. push ( route) ,
5548 }
5649 }
5750
5851 fn replace < ' a > ( & self , route : impl Into < Cow < ' a , str > > ) {
5952 match self {
60- #[ cfg( not( target_os = "wasi" ) ) ]
6153 Self :: Browser ( m) => m. replace ( route) ,
62- # [ cfg ( not ( target_os = "wasi" ) ) ]
54+
6355 Self :: Hash ( m) => m. replace ( route) ,
6456 Self :: Memory ( m) => m. replace ( route) ,
6557 }
@@ -70,9 +62,8 @@ impl History for AnyHistory {
7062 T : ' static ,
7163 {
7264 match self {
73- #[ cfg( not( target_os = "wasi" ) ) ]
7465 Self :: Browser ( m) => m. push_with_state ( route, state) ,
75- # [ cfg ( not ( target_os = "wasi" ) ) ]
66+
7667 Self :: Hash ( m) => m. push_with_state ( route, state) ,
7768 Self :: Memory ( m) => m. push_with_state ( route, state) ,
7869 }
@@ -83,9 +74,8 @@ impl History for AnyHistory {
8374 T : ' static ,
8475 {
8576 match self {
86- #[ cfg( not( target_os = "wasi" ) ) ]
8777 Self :: Browser ( m) => m. replace_with_state ( route, state) ,
88- # [ cfg ( not ( target_os = "wasi" ) ) ]
78+
8979 Self :: Hash ( m) => m. replace_with_state ( route, state) ,
9080 Self :: Memory ( m) => m. replace_with_state ( route, state) ,
9181 }
@@ -101,9 +91,8 @@ impl History for AnyHistory {
10191 Q : ToQuery ,
10292 {
10393 match self {
104- #[ cfg( not( target_os = "wasi" ) ) ]
10594 Self :: Browser ( m) => m. push_with_query ( route, query) ,
106- # [ cfg ( not ( target_os = "wasi" ) ) ]
95+
10796 Self :: Hash ( m) => m. push_with_query ( route, query) ,
10897 Self :: Memory ( m) => m. push_with_query ( route, query) ,
10998 }
@@ -118,9 +107,8 @@ impl History for AnyHistory {
118107 Q : ToQuery ,
119108 {
120109 match self {
121- #[ cfg( not( target_os = "wasi" ) ) ]
122110 Self :: Browser ( m) => m. replace_with_query ( route, query) ,
123- # [ cfg ( not ( target_os = "wasi" ) ) ]
111+
124112 Self :: Hash ( m) => m. replace_with_query ( route, query) ,
125113 Self :: Memory ( m) => m. replace_with_query ( route, query) ,
126114 }
@@ -138,9 +126,8 @@ impl History for AnyHistory {
138126 T : ' static ,
139127 {
140128 match self {
141- #[ cfg( not( target_os = "wasi" ) ) ]
142129 Self :: Browser ( m) => m. push_with_query_and_state ( route, query, state) ,
143- # [ cfg ( not ( target_os = "wasi" ) ) ]
130+
144131 Self :: Hash ( m) => m. push_with_query_and_state ( route, query, state) ,
145132 Self :: Memory ( m) => m. push_with_query_and_state ( route, query, state) ,
146133 }
@@ -158,9 +145,8 @@ impl History for AnyHistory {
158145 T : ' static ,
159146 {
160147 match self {
161- #[ cfg( not( target_os = "wasi" ) ) ]
162148 Self :: Browser ( m) => m. replace_with_query_and_state ( route, query, state) ,
163- # [ cfg ( not ( target_os = "wasi" ) ) ]
149+
164150 Self :: Hash ( m) => m. replace_with_query_and_state ( route, query, state) ,
165151 Self :: Memory ( m) => m. replace_with_query_and_state ( route, query, state) ,
166152 }
@@ -171,33 +157,29 @@ impl History for AnyHistory {
171157 CB : Fn ( ) + ' static ,
172158 {
173159 match self {
174- #[ cfg( not( target_os = "wasi" ) ) ]
175160 Self :: Browser ( m) => m. listen ( callback) ,
176- # [ cfg ( not ( target_os = "wasi" ) ) ]
161+
177162 Self :: Hash ( m) => m. listen ( callback) ,
178163 Self :: Memory ( m) => m. listen ( callback) ,
179164 }
180165 }
181166
182167 fn location ( & self ) -> Location {
183168 match self {
184- #[ cfg( not( target_os = "wasi" ) ) ]
185169 Self :: Browser ( m) => m. location ( ) ,
186- # [ cfg ( not ( target_os = "wasi" ) ) ]
170+
187171 Self :: Hash ( m) => m. location ( ) ,
188172 Self :: Memory ( m) => m. location ( ) ,
189173 }
190174 }
191175}
192176
193- #[ cfg( not( target_os = "wasi" ) ) ]
194177impl From < BrowserHistory > for AnyHistory {
195178 fn from ( m : BrowserHistory ) -> AnyHistory {
196179 AnyHistory :: Browser ( m)
197180 }
198181}
199182
200- #[ cfg( not( target_os = "wasi" ) ) ]
201183impl From < HashHistory > for AnyHistory {
202184 fn from ( m : HashHistory ) -> AnyHistory {
203185 AnyHistory :: Hash ( m)
0 commit comments