DS
Size: a a a
DS
ΑZ
ΑZ
DS
DS
ΑZ
ΑZ
ΑZ
pub async fn put_current_company_custom_settings<B: FromRequest + Deref<Target = CustomSettingsUpdate>>(
req: HttpRequest,
company_settings_service: web::Data<CompanySettingsService>,
uri_params: web::Path<(Uuid,)>,
body: B,
)
И
уже в регистрации ручки решать, что из тела или ещё откуда-то значение должно маппитсяΑZ
ΑZ
DS
ΑZ
DS
DS
ΑZ
struct ScopedDependency<'a, T>(&'a T);
impl<'a, T> FromRequest for ScopedDependency<'a, T>
{
type Error = ();
type Future = Ready<Result<Self, Self::Error>>;
type Config = ();
#[inline]
fn from_request(req: &'a HttpRequest, _: &mut Payload) -> Self::Future {
std::future::ready(
req.extensions().get::<T>().map(ScopedDependency).ok_or(())
)
}
}
ΑZ
ΑZ
fn from_request(req: &'a HttpRequest, _: &mut Payload)Но так не работает
ΑZ
fn from_request<'b>(req: &'b HttpRequest, _: &mut Payload) -> Ready<Result<ScopedDependency<'b, T>, Self::Error>> {
Но
так тожеDS
fn from_request(req: &'a HttpRequest, _: &mut Payload)Но так не работает
ΑZ
where
T: DeserializeOwned + 'static,