From 92b81899dd7b3a7ae1193608ad9427ee95c164ef Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 16 Oct 2017 20:13:47 -0700 Subject: [PATCH] update doc strings --- src/recognizer.rs | 4 ++++ src/router.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/recognizer.rs b/src/recognizer.rs index b95013759..6c01141c3 100644 --- a/src/recognizer.rs +++ b/src/recognizer.rs @@ -123,6 +123,9 @@ fn parse(pattern: &str) -> String { re } +/// Route match information +/// +/// If resource path contains variable patterns, `Params` stores this variables. #[derive(Debug)] pub struct Params { text: String, @@ -158,6 +161,7 @@ impl Params { .and_then(|m| m.map(|(start, end)| &self.text[start..end])) } + /// Get matched parameter by name pub fn get(&self, key: &str) -> Option<&str> { self.names.get(key).and_then(|&i| self.by_idx(i - 1)) } diff --git a/src/router.rs b/src/router.rs index 44d6202f4..eb1cd38d1 100644 --- a/src/router.rs +++ b/src/router.rs @@ -52,7 +52,7 @@ impl Router { /// A variable part is specified in the form `{identifier}`, where /// the identifier can be used later in a request handler to access the matched /// value for that part. This is done by looking up the identifier -/// in the Params object returned by `Request.match_info()` method. +/// in the `Params` object returned by `Request.match_info()` method. /// /// By default, each part matches the regular expression `[^{}/]+`. ///