From c71db88fac23839aab4a7bdc235534f4009b2f01 Mon Sep 17 00:00:00 2001 From: Jan Michael Auer Date: Fri, 6 Sep 2024 09:21:46 +0200 Subject: [PATCH] ref: Rename --- relay-server/src/endpoints/attachments.rs | 4 ++-- relay-server/src/endpoints/minidump.rs | 4 ++-- relay-server/src/extractors/remote.rs | 28 +++++++++++------------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/relay-server/src/endpoints/attachments.rs b/relay-server/src/endpoints/attachments.rs index e7d39bd881..7e1d33bd1d 100644 --- a/relay-server/src/endpoints/attachments.rs +++ b/relay-server/src/endpoints/attachments.rs @@ -7,7 +7,7 @@ use serde::Deserialize; use crate::endpoints::common::{self, BadStoreRequest}; use crate::envelope::{AttachmentType, Envelope}; -use crate::extractors::{RequestMeta, Xt}; +use crate::extractors::{Remote, RequestMeta}; use crate::service::ServiceState; use crate::utils; @@ -35,7 +35,7 @@ pub async fn handle( state: ServiceState, meta: RequestMeta, Path(path): Path, - Xt(multipart): Xt>, + Remote(multipart): Remote>, ) -> Result { let envelope = extract_envelope(meta, path, multipart).await?; common::handle_envelope(&state, envelope).await?; diff --git a/relay-server/src/endpoints/minidump.rs b/relay-server/src/endpoints/minidump.rs index cab227a11e..80d513d709 100644 --- a/relay-server/src/endpoints/minidump.rs +++ b/relay-server/src/endpoints/minidump.rs @@ -12,7 +12,7 @@ use relay_event_schema::protocol::EventId; use crate::constants::{ITEM_NAME_BREADCRUMBS1, ITEM_NAME_BREADCRUMBS2, ITEM_NAME_EVENT}; use crate::endpoints::common::{self, BadStoreRequest, TextResponse}; use crate::envelope::{AttachmentType, ContentType, Envelope, Item, ItemType}; -use crate::extractors::{RawContentType, RequestMeta, Xt}; +use crate::extractors::{RawContentType, Remote, RequestMeta}; use crate::service::ServiceState; use crate::utils; @@ -137,7 +137,7 @@ async fn handle( let envelope = if MINIDUMP_RAW_CONTENT_TYPES.contains(&content_type.as_ref()) { extract_raw_minidump(request.extract().await?, meta)? } else { - let Xt(multipart) = request.extract_with_state(&state).await?; + let Remote(multipart) = request.extract_with_state(&state).await?; extract_multipart(multipart, meta).await? }; diff --git a/relay-server/src/extractors/remote.rs b/relay-server/src/extractors/remote.rs index a9e0eff55b..f611476abc 100644 --- a/relay-server/src/extractors/remote.rs +++ b/relay-server/src/extractors/remote.rs @@ -1,4 +1,4 @@ -//! Extractors for types from other crates via [`Xt`]. +//! Extractors for types from other crates via [`Remote`]. use axum::extract::{FromRequest, Request}; use axum::http::StatusCode; @@ -8,7 +8,7 @@ use multer::Multipart; use crate::service::ServiceState; use crate::utils::{self, ApiErrorResponse}; -/// A transparent wrapper around a type that implements [`FromRequest`] or [`IntoResponse`]. +/// A transparent wrapper around a remote type that implements [`FromRequest`] or [`IntoResponse`]. /// /// # Example /// @@ -18,45 +18,45 @@ use crate::utils::{self, ApiErrorResponse}; /// use axum::extract::{FromRequest, Request}; /// use axum::response::IntoResponse; /// -/// use crate::extractors::Xt; +/// use crate::extractors::Remote; /// /// // Derive `FromRequest` for `bool` for illustration purposes: /// #[axum::async_trait] -/// impl axum::extract::FromRequest for Xt { -/// type Rejection = Xt; +/// impl axum::extract::FromRequest for Remote { +/// type Rejection = Remote; /// /// async fn from_request(request: Request) -> Result { -/// Ok(Xt(true)) +/// Ok(Remote(true)) /// } /// } /// -/// impl IntoResponse for Xt { +/// impl IntoResponse for Remote { /// fn into_response(self) -> axum::response::Response { /// match self.0 {} /// } /// } /// ``` #[derive(Debug)] -pub struct Xt(pub T); +pub struct Remote(pub T); -impl From for Xt { +impl From for Remote { fn from(inner: T) -> Self { Self(inner) } } #[axum::async_trait] -impl FromRequest for Xt> { - type Rejection = Xt; +impl FromRequest for Remote> { + type Rejection = Remote; async fn from_request(request: Request, state: &ServiceState) -> Result { utils::multipart_from_request(request, state.config()) - .map(Xt) - .map_err(Xt) + .map(Remote) + .map_err(Remote) } } -impl IntoResponse for Xt { +impl IntoResponse for Remote { fn into_response(self) -> Response { let Self(ref error) = self;