-
I'm trying to implement a cookie parser using the
If I leave out Option it works fine. But I want 3 states: use actix_web::{dev, Error, FromRequest, HttpRequest};
use futures_util::future::{ok, Ready};
use std::option::Option;
#[derive(Debug)]
pub struct Cookies {
pub session: String,
pub refresh: String,
}
impl FromRequest for Cookies { // works
// impl FromRequest for Option<Cookies> { // doesn't work
type Error = Error;
type Future = Ready<Result<Self, Self::Error>>;
type Config = ();
fn from_request(
req: &HttpRequest,
payload: &mut dev::Payload,
) -> Self::Future {
...
}
} Any advice how to do this? |
Beta Was this translation helpful? Give feedback.
Answered by
robjtede
Apr 11, 2021
Replies: 1 comment 13 replies
-
It's an overlapping impl. Actix Web already implements |
Beta Was this translation helpful? Give feedback.
13 replies
Answer selected by
shotor
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's an overlapping impl. Actix Web already implements
FromRequest for Option<T> where T: FromRequest