Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions codegen/src/enu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ pub enum Method {
PUT,
DELETE,
PATCH,
HEAD,
OPTIONS,
}

impl Method {
Expand All @@ -19,8 +17,6 @@ impl Method {
Method::PUT => "PUT",
Method::DELETE => "DELETE",
Method::PATCH => "PATCH",
Method::HEAD => "HEAD",
Method::OPTIONS => "OPTIONS",
}
}
pub fn from_str(str: &str) -> Result<Method, String> {
Expand All @@ -30,8 +26,6 @@ impl Method {
"put" | "PUT" => Ok(Method::PUT),
"delete" | "DELETE" => Ok(Method::DELETE),
"patch" | "PATCH" => Ok(Method::PATCH),
"head" | "HEAD" => Ok(Method::HEAD),
"options" | "OPTIONS" => Ok(Method::OPTIONS),
_ => Err("unknown request method marker: ".to_string() + str),
}
}
Expand Down
10 changes: 0 additions & 10 deletions codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@ pub fn patch(attr: TokenStream, item: TokenStream) -> TokenStream {
http_impl(Method::PATCH, attr, item)
}

#[proc_macro_attribute]
pub fn head(attr: TokenStream, item: TokenStream) -> TokenStream {
http_impl(Method::HEAD, attr, item)
}

#[proc_macro_attribute]
pub fn options(attr: TokenStream, item: TokenStream) -> TokenStream {
http_impl(Method::OPTIONS, attr, item)
}

#[proc_macro_derive(Context, attributes(url_path, query, header, param))]
pub fn feign_context(item: TokenStream) -> TokenStream {
feign_context_impl(item)
Expand Down
14 changes: 1 addition & 13 deletions examples/method.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
use feignhttp::{head, options, patch};
use feignhttp::patch;

#[patch("https://httpbin.org/patch")]
async fn patch() -> feignhttp::Result<String> {}

#[head("https://httpbin.org/get")]
async fn head() -> feignhttp::Result<()> {}

#[options("https://httpbin.org")]
async fn options() -> feignhttp::Result<String> {}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let r = patch().await?;
println!("patch result: {}", r);

head().await?;
println!("head ok");

let r = options().await?;
println!("options result: {}", r);

Ok(())
}
Loading