File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
6
6
and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
7
7
8
+ # Unreleased
9
+
10
+ - ** added:** ` Router::reset_fallback `
11
+
8
12
# 0.8.3
9
13
10
14
- ** added:** Implement ` From<Bytes> ` for ` Message ` ([ #3273 ] )
Original file line number Diff line number Diff line change @@ -381,6 +381,21 @@ where
381
381
} )
382
382
}
383
383
384
+ /// Reset the fallback to its default.
385
+ ///
386
+ /// Useful to merge two routers with fallbacks, as [`merge`] doesn't allow
387
+ /// both routers to have an explicit fallback. Use this method to remove the
388
+ /// one you want to discard before merging.
389
+ ///
390
+ /// [`merge`]: Self::merge
391
+ pub fn reset_fallback ( self ) -> Self {
392
+ tap_inner ! ( self , mut this => {
393
+ this. fallback_router = PathRouter :: new_fallback( ) ;
394
+ this. default_fallback = true ;
395
+ this. catch_all_fallback = Fallback :: Default ( Route :: new( NotFound ) ) ;
396
+ } )
397
+ }
398
+
384
399
fn fallback_endpoint ( self , endpoint : Endpoint < S > ) -> Self {
385
400
tap_inner ! ( self , mut this => {
386
401
this. fallback_router. set_fallback( endpoint) ;
You can’t perform that action at this time.
0 commit comments