-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #273 from c410-f3r/misc
Fix #260
- Loading branch information
Showing
76 changed files
with
1,019 additions
and
571 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pub(crate) mod api_params; | ||
pub(crate) mod contained_attrs; | ||
pub(crate) mod item_with_attr_span; | ||
pub(crate) mod owned_or_ref; | ||
pub(crate) mod pkg; | ||
pub(crate) mod transport_group; |
5 changes: 4 additions & 1 deletion
5
wtx-macros/src/api_params.rs → ...os/src/client_api_framework/api_params.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
wtx-macros/src/api_params/attrs.rs → .../client_api_framework/api_params/attrs.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
wtx-macros/src/pkg/data_format.rs → ...c/client_api_framework/pkg/data_format.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
wtx-macros/src/pkg/fir/fir_aux_field_attr.rs → ...i_framework/pkg/fir/fir_aux_field_attr.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...macros/src/pkg/fir/fir_aux_item_values.rs → ..._framework/pkg/fir/fir_aux_item_values.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 3 additions & 1 deletion
4
...cros/src/pkg/fir/fir_custom_field_attr.rs → ...ramework/pkg/fir/fir_custom_field_attr.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rc/pkg/fir/fir_custom_field_field_attr.rs → ...rk/pkg/fir/fir_custom_field_field_attr.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
wtx-macros/src/pkg/fir/fir_item_attr.rs → ...nt_api_framework/pkg/fir/fir_item_attr.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
wtx-macros/src/pkg/fir/fir_items_values.rs → ...api_framework/pkg/fir/fir_items_values.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion
4
...macros/src/pkg/fir/fir_res_item_values.rs → ..._framework/pkg/fir/fir_res_item_values.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
..._item_values/sir_items_values_creators.rs → ..._item_values/sir_items_values_creators.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...x_item_values/sir_items_values_pushers.rs → ...x_item_values/sir_items_values_pushers.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
wtx-macros/src/pkg/sir/sir_final_values.rs → ...api_framework/pkg/sir/sir_final_values.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use crate::{ | ||
use crate::client_api_framework::{ | ||
pkg::{ | ||
data_format_elems::DataFormatElems, | ||
fir::{ | ||
|
2 changes: 1 addition & 1 deletion
2
wtx-macros/src/pkg/sir/sir_pkg_attr.rs → ...ent_api_framework/pkg/sir/sir_pkg_attr.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use quote::quote; | ||
use syn::{parse_macro_input, Data, DeriveInput, Fields}; | ||
|
||
pub(crate) fn conn_aux(item: proc_macro::TokenStream) -> crate::Result<proc_macro::TokenStream> { | ||
let input = parse_macro_input::parse::<DeriveInput>(item)?; | ||
let name = input.ident; | ||
let mut field_names = Vec::new(); | ||
let mut field_tys = Vec::new(); | ||
match input.data { | ||
Data::Struct(data) => match data.fields { | ||
Fields::Named(fields) => { | ||
for elem in fields.named { | ||
field_names.push(elem.ident); | ||
field_tys.push(elem.ty); | ||
} | ||
} | ||
_ => return Err(crate::Error::UnsupportedStructure), | ||
}, | ||
_ => return Err(crate::Error::UnsupportedStructure), | ||
} | ||
let expanded = quote! { | ||
impl wtx::http::server_framework::ConnAux for #name { | ||
type Init = Self; | ||
|
||
#[inline] | ||
fn conn_aux(init: Self::Init) -> wtx::Result<Self> { | ||
Ok(init) | ||
} | ||
} | ||
|
||
#( | ||
impl wtx::misc::Lease<#field_tys> for #name { | ||
#[inline] | ||
fn lease(&self) -> &#field_tys { | ||
&self.#field_names | ||
} | ||
} | ||
|
||
impl wtx::misc::LeaseMut<#field_tys> for #name { | ||
#[inline] | ||
fn lease_mut(&mut self) -> &mut #field_tys { | ||
&mut self.#field_names | ||
} | ||
} | ||
)* | ||
}; | ||
Ok(proc_macro::TokenStream::from(expanded)) | ||
} |
Oops, something went wrong.