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
2 changes: 1 addition & 1 deletion module/core/clone_dyn_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ mod private
unsafe
{
let mut ptr = ref_dyn as *const T;
let data_ptr = &mut ptr as *mut *const T as *mut *mut ();
let data_ptr = &raw mut ptr as *mut *mut (); // fix clippy
*data_ptr = < T as CloneDyn >::__clone_dyn( ref_dyn, DontCallMe );
Box::from_raw( ptr as *mut T )
}
Expand Down
2 changes: 1 addition & 1 deletion module/core/data_type/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Macro [types](https://docs.rs/type_constructor/latest/type_constructor/types/mac

### Basic Use Case :: make - variadic constructor

Implement traits [`From_0`], [From1] up to `MakeN` to provide the interface to construct your structure with a different set of arguments.
Implement traits \[`From_0`\], \[`From1`\] up to `MakeN` to provide the interface to construct your structure with a different set of arguments.
In this example structure, Struct1 could be constructed either without arguments, with a single argument, or with two arguments.
- Constructor without arguments fills fields with zero.
- Constructor with a single argument sets both fields to the value of the argument.
Expand Down
1 change: 0 additions & 1 deletion module/core/data_type/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
pub mod dt;

/// Namespace with dependencies.

#[ cfg( feature = "enabled" ) ]
pub mod dependency
{
Expand Down
8 changes: 4 additions & 4 deletions module/core/derive_tools_meta/src/derive/from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ fn variant_generate
{
let debug = format!
(
r#"
r"
#[ automatically_derived ]
impl< {0} > From< {args} > for {item_name}< {1} >
where
Expand All @@ -510,16 +510,16 @@ where
Self::{variant_name}( {use_src} )
}}
}}
"#,
",
format!( "{}", qt!{ #generics_impl } ),
format!( "{}", qt!{ #generics_ty } ),
format!( "{}", qt!{ #generics_where } ),
);
let about = format!
(
r#"derive : From
r"derive : From
item : {item_name}
field : {variant_name}"#,
field : {variant_name}",
);
diag::report_print( about, original_input, debug );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use former_types::Assign;
///
/// Attributes of a field / variant
///

/// Represents the attributes of a struct. Aggregates all its attributes.
#[ derive( Debug, Default ) ]
pub struct FieldAttributes
Expand Down Expand Up @@ -181,10 +180,10 @@ impl syn::parse::Parse for FieldAttributeConfig
syn_err!
(
ident,
r#"Expects an attribute of format '#[ from( on ) ]'
r"Expects an attribute of format '#[ from( on ) ]'
{known}
But got: '{}'
"#,
",
qt!{ #ident }
)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use former_types::Assign;
///
/// Attributes of the whole tiem
///

/// Represents the attributes of a struct. Aggregates all its attributes.
#[ derive( Debug, Default ) ]
pub struct ItemAttributes
Expand Down Expand Up @@ -165,10 +164,10 @@ impl syn::parse::Parse for ItemAttributeConfig
syn_err!
(
ident,
r#"Expects an attribute of format '#[ from( off ) ]'
r"Expects an attribute of format '#[ from( off ) ]'
{known}
But got: '{}'
"#,
",
qt!{ #ident }
)
};
Expand Down
11 changes: 0 additions & 11 deletions module/core/derive_tools_meta/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ mod derive;
///
/// The macro facilitates the conversion without additional boilerplate code.
///

#[ cfg( feature = "enabled" ) ]
#[ cfg( feature = "derive_from" ) ]
#[ proc_macro_derive
Expand Down Expand Up @@ -134,7 +133,6 @@ pub fn from( input : proc_macro::TokenStream ) -> proc_macro::TokenStream
///
/// The macro facilitates the conversion without additional boilerplate code.
///

#[ cfg( feature = "enabled" ) ]
#[ cfg( feature = "derive_new" ) ]
#[ proc_macro_derive
Expand Down Expand Up @@ -229,7 +227,6 @@ pub fn new( input : proc_macro::TokenStream ) -> proc_macro::TokenStream
/// }
/// }
/// ```

#[ cfg( feature = "enabled" ) ]
#[ cfg( feature = "derive_inner_from" ) ]
#[ proc_macro_derive( InnerFrom, attributes( debug ) ) ]
Expand Down Expand Up @@ -270,7 +267,6 @@ pub fn inner_from( input : proc_macro::TokenStream ) -> proc_macro::TokenStream
/// }
/// }
/// ```

#[ cfg( feature = "enabled" ) ]
#[ cfg( feature = "derive_deref" ) ]
#[ proc_macro_derive( Deref, attributes( debug ) ) ]
Expand Down Expand Up @@ -330,7 +326,6 @@ pub fn deref( input : proc_macro::TokenStream ) -> proc_macro::TokenStream
/// }
///
/// ```

#[ cfg( feature = "enabled" ) ]
#[ cfg( feature = "derive_deref_mut" ) ]
#[ proc_macro_derive( DerefMut, attributes( debug ) ) ]
Expand Down Expand Up @@ -369,7 +364,6 @@ pub fn deref_mut( input : proc_macro::TokenStream ) -> proc_macro::TokenStream
/// }
/// }
/// ```

#[ cfg( feature = "enabled" ) ]
#[ cfg( feature = "derive_as_ref" ) ]
#[ proc_macro_derive( AsRef, attributes( debug ) ) ]
Expand Down Expand Up @@ -409,7 +403,6 @@ pub fn as_ref( input : proc_macro::TokenStream ) -> proc_macro::TokenStream
/// }
///
/// ```

#[ cfg( feature = "enabled" ) ]
#[ cfg( feature = "derive_as_mut" ) ]
#[ proc_macro_derive( AsMut, attributes( debug ) ) ]
Expand Down Expand Up @@ -514,7 +507,6 @@ pub fn as_mut( input : proc_macro::TokenStream ) -> proc_macro::TokenStream
/// }
/// ```
///

#[ cfg( feature = "enabled" ) ]
#[ cfg( feature = "derive_variadic_from" ) ]
#[ proc_macro_derive( VariadicFrom, attributes( debug ) ) ]
Expand Down Expand Up @@ -619,7 +611,6 @@ pub fn derive_not( input : proc_macro::TokenStream ) -> proc_macro::TokenStream
///
/// The macro facilitates the addition of the `PhantomData` field without additional boilerplate code.
///

#[ cfg( feature = "enabled" ) ]
#[ cfg ( feature = "derive_phantom" ) ]
#[ proc_macro_attribute ]
Expand Down Expand Up @@ -675,7 +666,6 @@ pub fn phantom( _attr: proc_macro::TokenStream, input : proc_macro::TokenStream
/// };
/// ```
///

#[ cfg( feature = "enabled" ) ]
#[ cfg( feature = "derive_index" ) ]
#[ proc_macro_derive
Expand Down Expand Up @@ -745,7 +735,6 @@ pub fn derive_index( input : proc_macro::TokenStream ) -> proc_macro::TokenStrea
/// };
/// ```
///

#[ cfg( feature = "enabled" ) ]
#[ cfg( feature = "derive_index_mut" ) ]
#[ proc_macro_derive
Expand Down
1 change: 0 additions & 1 deletion module/core/former_meta/src/component/component_from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ pub fn component_from( input : proc_macro::TokenStream ) -> Result< proc_macro2:
/// }
/// }
///

fn for_each_field( field : &syn::Field, item_name : &syn::Ident ) -> Result< proc_macro2::TokenStream >
{
let field_name = field.ident.as_ref()
Expand Down
3 changes: 1 addition & 2 deletions module/core/former_meta/src/component/components_assign.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#[ allow( clippy::wildcard_imports ) ]
use super::*;
use macro_tools::{ attr, diag, Result, format_ident };
use iter_tools::{ Itertools };
use iter_tools::Itertools;

///
/// Generate `ComponentsAssign` trait implementation for the type, providing `components_assign` function
///
/// Output example can be found in in the root of the module
///

pub fn components_assign( input : proc_macro::TokenStream ) -> Result< proc_macro2::TokenStream >
{
use convert_case::{ Case, Casing };
Expand Down
3 changes: 0 additions & 3 deletions module/core/former_meta/src/component/from_components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ use macro_tools::{ attr, diag, item_struct, Result };
/// }
/// ```
///

#[ inline ]
pub fn from_components( input : proc_macro::TokenStream ) -> Result< proc_macro2::TokenStream >
{
Expand Down Expand Up @@ -97,7 +96,6 @@ pub fn from_components( input : proc_macro::TokenStream ) -> Result< proc_macro2
/// ```
///
/// These trait bounds are then used in the `From<T>` implementation to ensure type compatibility.

#[ inline ]
// fn trait_bounds( field_types : &[ &syn::Type ] ) -> Vec< proc_macro2::TokenStream >
fn trait_bounds< 'a >( field_types : impl macro_tools::IterTrait< 'a, &'a syn::Type > ) -> Vec< proc_macro2::TokenStream >
Expand Down Expand Up @@ -125,7 +123,6 @@ fn trait_bounds< 'a >( field_types : impl macro_tools::IterTrait< 'a, &'a syn::T
/// let field2 = Into::< String >::into( src.clone() );
/// ```
///

#[ inline ]
fn field_assign< 'a >( fields : impl Iterator< Item = &'a syn::Field > ) -> Vec< proc_macro2::TokenStream >
{
Expand Down
28 changes: 12 additions & 16 deletions module/core/former_meta/src/derive_former.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[ allow( clippy::wildcard_imports ) ]
use super::*;
use iter_tools::{ Itertools };
use iter_tools::Itertools;
use macro_tools::{ attr, diag, generic_params, generic_args, typ, derive, Result };
use proc_macro2::TokenStream;

Expand Down Expand Up @@ -77,7 +77,7 @@ pub fn mutator
{
let debug = format!
(
r#"
r"
= Example of custom mutator

impl< {} > former::FormerMutator
Expand All @@ -91,16 +91,16 @@ where
{{
}}
}}
"#,
",
format!( "{}", qt!{ #former_definition_types_generics_impl } ),
format!( "{}", qt!{ #former_definition_types_generics_ty } ),
format!( "{}", qt!{ #former_definition_types_generics_where } ),
);
// println!( "{debug}" );
let about = format!
(
r#"derive : Former
item : {item}"#,
r"derive : Former
item : {item}",
);
diag::report_print( about, original_input, debug );
};
Expand All @@ -116,18 +116,18 @@ fn doc_generate( item : &syn::Ident ) -> ( String, String )

let doc_former_mod = format!
(
r#" Implementation of former for [{item}].
"#
r" Implementation of former for [{item}].
"
);

let doc_former_struct = format!
(
r#"
r"
Structure to form [{item}]. Represents a forming entity designed to construct objects through a builder pattern.

This structure holds temporary storage and context during the formation process and
utilizes a defined end strategy to finalize the object creation.
"#
"
);

( doc_former_mod, doc_former_struct )
Expand All @@ -144,11 +144,7 @@ pub fn former( input : proc_macro::TokenStream ) -> Result< TokenStream >
use macro_tools::IntoGenericArgs;

let original_input = input.clone();
let ast = match syn::parse::< syn::DeriveInput >( input )
{
Ok( syntax_tree ) => syntax_tree,
Err( err ) => return Err( err ),
};
let ast = syn::parse::< syn::DeriveInput >( input )?;
let has_debug = attr::has_debug( ast.attrs.iter() )?;
let struct_attrs = ItemAttributes::from_attrs( ast.attrs.iter() )?;

Expand All @@ -165,12 +161,12 @@ pub fn former( input : proc_macro::TokenStream ) -> Result< TokenStream >

let as_subformer_end_doc = format!
(
r#"
r"
Represents an end condition for former of [`${item}`], tying the lifecycle of forming processes to a broader context.

This trait is intended for use with subformer alias, ensuring that end conditions are met according to the
specific needs of the broader forming context. It mandates the implementation of `former::FormingEnd`.
"#
"
);

/* parameters for structure */
Expand Down
Loading
Loading