1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-30 18:34:36 +01:00

update doc strings

This commit is contained in:
Nikolay Kim 2017-10-16 20:13:47 -07:00
parent de2f604fea
commit 92b81899dd
2 changed files with 5 additions and 1 deletions

View File

@ -123,6 +123,9 @@ fn parse(pattern: &str) -> String {
re re
} }
/// Route match information
///
/// If resource path contains variable patterns, `Params` stores this variables.
#[derive(Debug)] #[derive(Debug)]
pub struct Params { pub struct Params {
text: String, text: String,
@ -158,6 +161,7 @@ impl Params {
.and_then(|m| m.map(|(start, end)| &self.text[start..end])) .and_then(|m| m.map(|(start, end)| &self.text[start..end]))
} }
/// Get matched parameter by name
pub fn get(&self, key: &str) -> Option<&str> { pub fn get(&self, key: &str) -> Option<&str> {
self.names.get(key).and_then(|&i| self.by_idx(i - 1)) self.names.get(key).and_then(|&i| self.by_idx(i - 1))
} }

View File

@ -52,7 +52,7 @@ impl Router {
/// A variable part is specified in the form `{identifier}`, where /// A variable part is specified in the form `{identifier}`, where
/// the identifier can be used later in a request handler to access the matched /// 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 /// 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 `[^{}/]+`. /// By default, each part matches the regular expression `[^{}/]+`.
/// ///