remove old methods

This commit is contained in:
Rob Ede 2021-07-17 17:12:44 +01:00
parent e75176f44e
commit b7a04fad27
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
3 changed files with 9 additions and 34 deletions

View File

@ -3,19 +3,19 @@
## Unreleased - 2021-xx-xx
* Resource definitions with unnamed tail segments now correctly interpolate the tail when constructed from an iterator. [#371]
* Introduce `ResourceDef::resource_path_from_map_with_tail` method to allow building paths in the presence of unnamed tail segments. [#371]
* Introduce `ResourceDef::pattern_iter` to get an iterator over all patterns in a multi-pattern resource. [#373]
* Fix segment interpolation leaving `Path` in unintended state after matching. [#368]
* Path tail pattern now works as expected after a dynamic segment (e.g. `/user/{uid}/*`). [#366]
* Fixed a bug where, in multi-patterns, static patterns are interpreted as regex. [#366]
* Fixed a bug in multi-patterns where static patterns are interpreted as regex. [#366]
* Re-work `IntoPatterns` trait. [#372]
* Rename `Path::{len => segment_count}` to be more descriptive of it's purpose. [#370]
* Alias `ResourceDef::{resource_path => resource_path_from_iter}` pending eventual deprecation. [#371]
* Alias `ResourceDef::{resource_path_named => resource_path_from_map}` pending eventual deprecation. [#371]
* Rename `ResourceDef::{resource_path => resource_path_from_iter}`. [#371]
* Rename `ResourceDef::{resource_path_named => resource_path_from_map}`. [#371]
* Rename `ResourceDef::{match_path => is_path_match}`. [#373]
* Rename `ResourceDef::{match_path_checked => is_path_match_fn}`. [#373]
* Remove `ResourceDef::name_mut` and introduce `ResourceDef::set_name`. [#373]
* Return type of `ResourceDef::name` is now `Option<&str>`. [#373]
* Return type of `ResourceDef::pattern` is now `Option<&str>`. [#373]
* Introduce `ResourceDef::pattern_iter` to get an iterator over all patterns in a multi-pattern resource. [#373]
* Rename `ResourceDef::{match_path => is_path_match}`. [#373]
* Rename `ResourceDef::{match_path_checked => is_path_match_fn}`. [#373]
[#368]: https://github.com/actix/actix-net/pull/368
[#366]: https://github.com/actix/actix-net/pull/366

View File

@ -122,7 +122,7 @@ impl<T: ResourcePath> Path<T> {
/// Get matched parameter by name without type conversion
pub fn get(&self, key: &str) -> Option<&str> {
profile_method!(get);
for item in self.segments.iter() {
if key == item.0 {
return match item.1 {
@ -150,7 +150,7 @@ impl<T: ResourcePath> Path<T> {
/// If keyed parameter is not available empty string is used as default value.
pub fn query(&self, key: &str) -> &str {
profile_method!(query);
if let Some(s) = self.get(key) {
s
} else {

View File

@ -674,17 +674,6 @@ impl ResourceDef {
self.build_resource_path(path, |_| values.next())
}
// intentionally not deprecated yet
#[doc(hidden)]
pub fn resource_path<U, I>(&self, path: &mut String, values: &mut U) -> bool
where
U: Iterator<Item = I>,
I: AsRef<str>,
{
profile_method!(build_resource_path);
self.resource_path_from_iter(path, values)
}
/// Assembles resource path from map of dynamic segment values.
///
/// Returns `true` on success.
@ -708,21 +697,6 @@ impl ResourceDef {
})
}
// intentionally not deprecated yet
#[doc(hidden)]
pub fn resource_path_named<K, V, S>(
&self,
path: &mut String,
values: &HashMap<K, V, S>,
) -> bool
where
K: Borrow<str> + Eq + Hash,
V: AsRef<str>,
S: BuildHasher,
{
self.resource_path_from_map(path, values)
}
/// Assembles resource path from map of dynamic segment values, allowing tail segments to
/// be appended.
///
@ -1278,6 +1252,7 @@ mod tests {
assert_eq!(path.unprocessed(), "subpath1/subpath2/index.html");
let resource = ResourceDef::prefix("/user");
// input string shorter than prefix
assert!(resource.is_prefix_match("/foo").is_none());
}