diff --git a/router/CHANGES.txt b/router/CHANGES.txt index d966586f..9944a14f 100644 --- a/router/CHANGES.txt +++ b/router/CHANGES.txt @@ -1,5 +1,9 @@ # Changes +## [0.2.2] - 2019-12-25 + +* Use `IntoPattern` for `RouterBuilder::path()` + ## [0.2.1] - 2019-12-25 * Add `IntoPattern` trait diff --git a/router/Cargo.toml b/router/Cargo.toml index c93b0ee1..8aba0050 100644 --- a/router/Cargo.toml +++ b/router/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-router" -version = "0.2.1" +version = "0.2.2" authors = ["Nikolay Kim "] description = "Path router" keywords = ["actix"] diff --git a/router/src/router.rs b/router/src/router.rs index bffc208f..c65ac2db 100644 --- a/router/src/router.rs +++ b/router/src/router.rs @@ -1,4 +1,4 @@ -use crate::{Resource, ResourceDef, ResourcePath}; +use crate::{IntoPattern, Resource, ResourceDef, ResourcePath}; #[derive(Debug, Copy, Clone, PartialEq)] pub struct ResourceId(pub u16); @@ -70,7 +70,11 @@ pub struct RouterBuilder { impl RouterBuilder { /// Register resource for specified path. - pub fn path(&mut self, path: &str, resource: T) -> &mut (ResourceDef, T, Option) { + pub fn path( + &mut self, + path: P, + resource: T, + ) -> &mut (ResourceDef, T, Option) { self.resources .push((ResourceDef::new(path), resource, None)); self.resources.last_mut().unwrap()