(cookies: &Cookies)
| 17 | const FLASH_COOKIE_NAME: &str = "_flash"; |
| 18 | |
| 19 | pub fn get_flash_cookie<T>(cookies: &Cookies) -> Option<T> |
| 20 | where |
| 21 | T: DeserializeOwned, |
| 22 | { |
| 23 | cookies.get(FLASH_COOKIE_NAME).and_then(|flash_cookie| { |
| 24 | if let Ok(ValuedMessage::<T> { value }) = serde_json::from_str(flash_cookie.value()) { |
| 25 | Some(value) |
| 26 | } else { |
| 27 | None |
| 28 | } |
| 29 | }) |
| 30 | } |
| 31 | |
| 32 | pub type PostResponse = (StatusCode, HeaderMap); |
| 33 |