update changelog

This commit is contained in:
Rob Ede 2021-07-16 20:31:09 +01:00
parent 1500fb457a
commit ad4ed667fe
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
2 changed files with 10 additions and 5 deletions

View File

@ -1,15 +1,20 @@
# Changes # Changes
## Unreleased - 2021-xx-xx ## 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]
* Fix segment interpolation leaving `Path` in unintended state after matching. [#368] * 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] * 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 where, in multi-patterns, static patterns are interpreted as regex. [#366]
* Rename `Path::{len => segment_count}` to be more descriptive of it's purpose. [#370] * 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]
[#368]: https://github.com/actix/actix-net/pull/368 [#368]: https://github.com/actix/actix-net/pull/368
[#366]: https://github.com/actix/actix-net/pull/366 [#366]: https://github.com/actix/actix-net/pull/366
[#368]: https://github.com/actix/actix-net/pull/368 [#368]: https://github.com/actix/actix-net/pull/368
[#370]: https://github.com/actix/actix-net/pull/370 [#370]: https://github.com/actix/actix-net/pull/370
[#371]: https://github.com/actix/actix-net/pull/371
## 0.4.0 - 2021-06-06 ## 0.4.0 - 2021-06-06

View File

@ -448,7 +448,7 @@ impl ResourceDef {
}) })
} }
fn parse_param(pattern: &str) -> (PatternElement, String, &str, bool) { fn parse_param(pattern: &str) -> (PatternElement, String, &str) {
const DEFAULT_PATTERN: &str = "[^/]+"; const DEFAULT_PATTERN: &str = "[^/]+";
const DEFAULT_PATTERN_TAIL: &str = ".*"; const DEFAULT_PATTERN_TAIL: &str = ".*";
@ -502,7 +502,7 @@ impl ResourceDef {
let regex = format!(r"(?P<{}>{})", &name, &pattern); let regex = format!(r"(?P<{}>{})", &name, &pattern);
(element, regex, unprocessed, tail) (element, regex, unprocessed)
} }
fn parse( fn parse(
@ -532,9 +532,9 @@ impl ResourceDef {
elements.push(PatternElement::Const(prefix.to_owned())); elements.push(PatternElement::Const(prefix.to_owned()));
re.push_str(&escape(prefix)); re.push_str(&escape(prefix));
let (param_pattern, re_part, rem, tail) = Self::parse_param(rem); let (param_pattern, re_part, rem) = Self::parse_param(rem);
if tail { if matches!(param_pattern, PatternElement::Tail(_)) {
has_tail_segment = true; has_tail_segment = true;
} }
@ -556,7 +556,7 @@ impl ResourceDef {
dyn_elements += 1; dyn_elements += 1;
} else if !has_tail_segment { } else if !has_tail_segment {
// prevent `Const("")` element from being added after dynamic segments // prevent `Const("")` element from being added after tail segments
elements.push(PatternElement::Const(pattern.to_owned())); elements.push(PatternElement::Const(pattern.to_owned()));
re.push_str(&escape(pattern)); re.push_str(&escape(pattern));