diff --git a/actix-router/CHANGES.md b/actix-router/CHANGES.md index f268ffa9c..17d149b69 100644 --- a/actix-router/CHANGES.md +++ b/actix-router/CHANGES.md @@ -1,6 +1,10 @@ # Changes ## Unreleased - 2021-xx-xx +- Add `Path::as_str`. [#2590] +- Deprecate `Path::path`. [#2590] + +[#2590]: https://github.com/actix/actix-web/pull/2590 ## 0.5.0-rc.1 - 2022-01-14 diff --git a/actix-router/src/path.rs b/actix-router/src/path.rs index ac0591665..21bc63151 100644 --- a/actix-router/src/path.rs +++ b/actix-router/src/path.rs @@ -50,16 +50,15 @@ impl Path { } /// Returns full path as a string. - /// - /// Use this instead of ` + #[inline] pub fn as_str(&self) -> &str { + profile_method!(as_str); self.path.path() } /// Returns unprocessed part of the path. /// - /// # Panics - /// Unlike [`path`](Self::path), this will panic if `skip` indexes further than the path length. + /// Returns empty string if no more is to be processed. #[inline] pub fn unprocessed(&self) -> &str { profile_method!(unprocessed);