mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
http_protocol: remove axum helpers
This commit is contained in:
parent
195815b2c4
commit
50647d0774
3 changed files with 0 additions and 168 deletions
|
|
@ -117,17 +117,6 @@ impl AnnounceResponse {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "axum")]
|
||||
impl axum::response::IntoResponse for AnnounceResponse {
|
||||
fn into_response(self) -> axum::response::Response {
|
||||
let mut response_bytes = Vec::with_capacity(128);
|
||||
|
||||
self.write(&mut response_bytes).unwrap();
|
||||
|
||||
([("Content-type", "text/plain")], response_bytes).into_response()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ScrapeResponse {
|
||||
/// BTreeMap instead of HashMap since keys need to be serialized in order
|
||||
|
|
@ -158,17 +147,6 @@ impl ScrapeResponse {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "axum")]
|
||||
impl axum::response::IntoResponse for ScrapeResponse {
|
||||
fn into_response(self) -> axum::response::Response {
|
||||
let mut response_bytes = Vec::with_capacity(128);
|
||||
|
||||
self.write(&mut response_bytes).unwrap();
|
||||
|
||||
([("Content-type", "text/plain")], response_bytes).into_response()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct FailureResponse {
|
||||
#[serde(rename = "failure reason")]
|
||||
|
|
@ -197,17 +175,6 @@ impl FailureResponse {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "axum")]
|
||||
impl axum::response::IntoResponse for FailureResponse {
|
||||
fn into_response(self) -> axum::response::Response {
|
||||
let mut response_bytes = Vec::with_capacity(64);
|
||||
|
||||
self.write(&mut response_bytes).unwrap();
|
||||
|
||||
([("Content-type", "text/plain")], response_bytes).into_response()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum Response {
|
||||
|
|
@ -229,17 +196,6 @@ impl Response {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "axum")]
|
||||
impl axum::response::IntoResponse for Response {
|
||||
fn into_response(self) -> axum::response::Response {
|
||||
match self {
|
||||
Self::Announce(r) => r.into_response(),
|
||||
Self::Scrape(r) => r.into_response(),
|
||||
Self::Failure(r) => r.into_response(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
impl quickcheck::Arbitrary for ResponsePeer<Ipv4Addr> {
|
||||
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue