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:
@ -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],
|
||||
|
@ -1,4 +1,5 @@
|
||||
//! Resource path matching library.
|
||||
|
||||
mod de;
|
||||
mod path;
|
||||
mod resource;
|
||||
|
@ -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"));
|
||||
|
Reference in New Issue
Block a user