1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-29 01:50:35 +02:00

prepare router 0.2.5 release (#198)

This commit is contained in:
Rob Ede
2020-09-21 22:46:59 +01:00
committed by GitHub
parent e5ca271764
commit 6c65e2a79f
5 changed files with 22 additions and 25 deletions

View File

@ -161,9 +161,7 @@ impl<'de, T: ResourcePath + 'de> Deserializer<'de> for PathDeserializer<'de, T>
V: Visitor<'de>,
{
if self.path.is_empty() {
Err(de::value::Error::custom(
"expeceted at least one parameters",
))
Err(de::value::Error::custom("expected at least one parameters"))
} else {
visitor.visit_enum(ValueEnum {
value: &self.path[0],

View File

@ -1,4 +1,5 @@
//! Resource path matching library.
mod de;
mod path;
mod resource;

View File

@ -155,7 +155,7 @@ impl ResourceDef {
}
#[inline]
/// Check if path matchs this pattern?
/// Check if path matches this pattern.
pub fn is_match(&self, path: &str) -> bool {
match self.tp {
PatternType::Static(ref s) => s == path,
@ -165,7 +165,7 @@ impl ResourceDef {
}
}
/// Is prefix path a match against this resource?
/// Is prefix path a match against this resource.
pub fn is_prefix_match(&self, path: &str) -> Option<usize> {
let plen = path.len();
let path = if path.is_empty() { "/" } else { path };
@ -240,7 +240,7 @@ impl ResourceDef {
}
}
/// Is the given path and parameters a match against this pattern?
/// Is the given path and parameters a match against this pattern.
pub fn match_path<T: ResourcePath>(&self, path: &mut Path<T>) -> bool {
match self.tp {
PatternType::Static(ref s) => {
@ -875,7 +875,7 @@ mod tests {
}
#[test]
fn test_reousrce_prefix_dynamic() {
fn test_resource_prefix_dynamic() {
let re = ResourceDef::prefix("/{name}/");
assert!(re.is_match("/name/"));
assert!(re.is_match("/name/gs"));