mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-27 17:22:57 +01:00
update doc strings
This commit is contained in:
parent
de2f604fea
commit
92b81899dd
@ -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))
|
||||||
}
|
}
|
||||||
|
@ -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 `[^{}/]+`.
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user