Skip to content

Commit

Permalink
More bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
hhanh00 committed Sep 12, 2024
1 parent fa29576 commit a05c914
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dart-warp
14 changes: 14 additions & 0 deletions warp-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ pub fn c_export(_attr: TokenStream, item: TokenStream) -> TokenStream {
let mut has_connection = false;
let mut mut_connection = false;
let mut has_client = false;
let mut has_url = false;
for input in inputs.iter() {
if let FnArg::Typed(pat) = input {
if let Pat::Ident(param) = pat.pat.as_ref() {
Expand All @@ -134,6 +135,10 @@ pub fn c_export(_attr: TokenStream, item: TokenStream) -> TokenStream {
has_network = true;
continue;
}
"url" => {
has_url = true;
continue;
}
"connection" => {
has_connection = true;
if type_name == "& mut Connection" {
Expand Down Expand Up @@ -214,6 +219,13 @@ pub fn c_export(_attr: TokenStream, item: TokenStream) -> TokenStream {
} else {
quote! {}
};
let url = if has_url {
quote! {
let url = coin.url.clone();
}
} else {
quote! {}
};
let connection = if has_connection {
if mut_connection {
quote! {
Expand Down Expand Up @@ -264,6 +276,7 @@ pub fn c_export(_attr: TokenStream, item: TokenStream) -> TokenStream {
};
#network
#connection
#url
#client
#(#convs)*
#ident(#(#args),*).await
Expand All @@ -285,6 +298,7 @@ pub fn c_export(_attr: TokenStream, item: TokenStream) -> TokenStream {
};
#network
#connection
#url
#client
#(#convs)*
#ident(#(#args),*)
Expand Down

0 comments on commit a05c914

Please sign in to comment.