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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ version = "1.21.0"

[workspace.dependencies.convert_case]
version = "0.6.0"
default-features = false

## External - parse

Expand Down
4 changes: 1 addition & 3 deletions module/core/diagnostics_tools/Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- {{# generate.module_header{} #}} -->

# Module :: diagnostics_tools
# Module :: `diagnostics_tools`
<!--{ generate.module_header.start() }-->
[![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) [![rust-status](https://github.com/Wandalen/wTools/actions/workflows/module_diagnostics_tools_push.yml/badge.svg)](https://github.com/Wandalen/wTools/actions/workflows/module_diagnostics_tools_push.yml) [![docs.rs](https://img.shields.io/docsrs/diagnostics_tools?color=e3e8f0&logo=docs.rs)](https://docs.rs/diagnostics_tools) [![Open in Gitpod](https://raster.shields.io/static/v1?label=try&message=online&color=eee&logo=gitpod&logoColor=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fdiagnostics_tools%2Fexamples%2Fdiagnostics_tools_trivial.rs,RUN_POSTFIX=--example%20module%2Fcore%2Fdiagnostics_tools%2Fexamples%2Fdiagnostics_tools_trivial.rs/https://github.com/Wandalen/wTools) [![discord](https://img.shields.io/discord/872391416519737405?color=eee&logo=discord&logoColor=eee&label=ask)](https://discord.gg/m3YfbXpUUY)
<!--{ generate.module_header.end }-->
Expand All @@ -12,8 +12,6 @@ Diagnostics tools.
<!-- {{# generate.module{} #}} -->

```rust
#[ test ]
#[ should_panic ]
fn a_id_panic_test()
{
a_id!( 1, 2 );
Expand Down
1 change: 0 additions & 1 deletion module/core/diagnostics_tools/src/diag/cta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mod private
/// cta_true!( any( feature = "diagnostics_compiletime_assertions", feature = "diagnostics_compiletime_assertions" ) );
/// ```
///

#[ macro_export ]
macro_rules! cta_true
{
Expand Down
8 changes: 0 additions & 8 deletions module/core/diagnostics_tools/src/diag/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ mod private
///
/// Compile-time assertion that two types have the same size.
///


#[ macro_export ]
macro_rules! cta_type_same_size
{
Expand All @@ -25,8 +23,6 @@ mod private
///
/// Compile-time assertion of having the same align.
///


#[ macro_export ]
macro_rules! cta_type_same_align
{
Expand All @@ -43,8 +39,6 @@ mod private
///
/// Compile-time assertion that memory behind two references have the same size.
///


#[ macro_export ]
macro_rules! cta_ptr_same_size
{
Expand All @@ -66,8 +60,6 @@ mod private
///
/// Does not consume values.
///


#[ macro_export ]
macro_rules! cta_mem_same_size
{
Expand Down
22 changes: 4 additions & 18 deletions module/core/diagnostics_tools/src/diag/rta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ mod private
/// use diagnostics_tools::prelude::*;
/// a_true!( 1 == 1, "something wrong" );
/// ```
///

#[ macro_export ]
macro_rules! a_true
{
Expand All @@ -39,8 +37,6 @@ mod private
/// use diagnostics_tools::prelude::*;
/// a_true!( 1 == 2, "something wrong" );
/// ```
///

#[ macro_export ]
macro_rules! a_false
{
Expand All @@ -58,16 +54,14 @@ mod private
/// Asserts that a boolean expression is true at runtime.
///
/// This will invoke the panic! macro if the provided expression cannot be evaluated to true at runtime.
/// Like [a_true!], this macro also has a second version, where a custom panic message can be provided.
/// Like [`a_true!`], this macro also has a second version, where a custom panic message can be provided.
///
/// ### Basic use-case.
///
/// ``` rust
/// use diagnostics_tools::prelude::*;
/// a_dbg_true!( 1 == 1, "something wrong" );
/// ```
///

#[ macro_export ]
macro_rules! a_dbg_true
{
Expand All @@ -85,16 +79,14 @@ mod private
/// Asserts that a boolean expression is false at runtime.
///
/// This will invoke the panic! macro if the provided expression cannot be evaluated to false at runtime.
/// Like [a_false!], this macro also has a second version, where a custom panic message can be provided.
/// Like [`a_false!`], this macro also has a second version, where a custom panic message can be provided.
///
/// ### Basic use-case.
///
/// ``` should_panic
/// use diagnostics_tools::prelude::*;
/// a_dbg_true!( 1 == 2, "something wrong" );
/// ```
///

#[ macro_export ]
macro_rules! a_dbg_false
{
Expand All @@ -112,16 +104,14 @@ mod private
/// Asserts that two expressions are identical.
///
/// This macro will invoke the panic! macro if the two expressions have different values at runtime.
/// Like [a_id!], this macro also has a second version where a custom panic message can be provided.
/// Like [`a_id!`], this macro also has a second version where a custom panic message can be provided.
///
/// ### Basic use-case.
///
/// ``` rust
/// use diagnostics_tools::prelude::*;
/// a_dbg_id!( 1, 1, "something wrong" );
/// ```
///

#[ macro_export ]
macro_rules! a_dbg_id
{
Expand All @@ -142,16 +132,14 @@ mod private
/// Asserts that two expressions are not identical with each other.
///
/// This will invoke the panic! macro if two experessions have the same value at runtime.
/// Like [a_id!], this macro also has a second version, where a custom panic message can be provided.
/// Like [`a_id!`], this macro also has a second version, where a custom panic message can be provided.
///
/// ### Basic use-case.
///
/// ``` rust
/// use diagnostics_tools::prelude::*;
/// a_dbg_not_id!( 1, 2, "something wrong" );
/// ```
///

#[ macro_export ]
macro_rules! a_dbg_not_id
{
Expand All @@ -174,7 +162,6 @@ mod private
///
/// Asserts that two expressions are identical to each other (using [`PartialEq`]). Prints nice diff.
///

#[macro_export]
macro_rules! a_id
{
Expand All @@ -193,7 +180,6 @@ mod private
///
/// Asserts that two expressions are not identical to each other (using [`PartialEq`]). Prints nice diff.
///

#[macro_export]
macro_rules! a_not_id
{
Expand Down
1 change: 0 additions & 1 deletion module/core/diagnostics_tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
pub mod diag;

/// Namespace with dependencies.

#[ cfg( feature = "enabled" ) ]
pub mod dependency
{
Expand Down
68 changes: 0 additions & 68 deletions module/core/former/debug_plan.md

This file was deleted.

11 changes: 6 additions & 5 deletions module/core/former/examples/former_custom_collection.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Example former_custom_collection.rs
//! Example `former_custom_collection.rs`
//!
//! This example demonstrates how to define and use a custom collection with former.
//! The custom collection implemented here is a `LoggingSet`, which extends the basic `HashSet` behavior
Expand All @@ -10,6 +10,7 @@
fn main() {}

#[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ]
#[allow(clippy::too_many_lines)]
fn main()
{
use collection_tools::HashSet;
Expand All @@ -33,15 +34,15 @@ fn main()
{
Self
{
set : Default::default() // Initialize the internal HashSet.
set : HashSet::default() // Initialize the internal HashSet.
}
}
}

// Allow the custom collection to be converted into an iterator, to iterate over the elements.
impl< K > IntoIterator for LoggingSet< K >
where
K : core::cmp::Eq + std::hash::Hash,
K : core::cmp::Eq + core::hash::Hash,
{
type Item = K;
type IntoIter = collection_tools::hash_set::IntoIter< K >;
Expand All @@ -55,7 +56,7 @@ fn main()
// Similar iterator functionality but for borrowing the elements.
impl<'a, K> IntoIterator for &'a LoggingSet< K >
where
K : core::cmp::Eq + std::hash::Hash,
K : core::cmp::Eq + core::hash::Hash,
{
type Item = &'a K;
type IntoIter = collection_tools::hash_set::Iter< 'a, K >;
Expand Down Expand Up @@ -274,7 +275,7 @@ fn main()
.end()
.form();

println!("Got: {:?}", parent);
println!("Got: {parent:?}");
// > Parent { children: LoggingSet { set: {10, 20} } }

}
15 changes: 9 additions & 6 deletions module/core/former/examples/former_custom_subform_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,27 @@ fn main()
children : HashMap< String, Child >,
}

/// The containr setter provides a collection setter that returns a CollectionFormer tailored for managing a collection of child entities. It employs a generic collection definition to facilitate operations on the entire collection, such as adding or updating elements.
/// The containr setter provides a collection setter that returns a `CollectionFormer` tailored for managing a collection of child entities. It employs a generic collection definition to facilitate operations on the entire collection, such as adding or updating elements.
impl< Definition, > ParentFormer< Definition, >
where
Definition : former::FormerDefinition< Storage = ParentFormerStorage >,
{

#[ inline( always ) ]
pub fn children( self ) -> former::CollectionFormer::
<
( String, Child ),
former::HashMapDefinition< String, Child, Self, Self, ParentSubformCollectionChildrenEnd< Definition >, >
>
pub fn children( self ) -> ParentChildrenFormer< Self, Definition >
{
self._children_subform_collection()
}

}

pub type ParentChildrenFormer< SuperFormer, Definition > =
former::CollectionFormer::
<
( String, Child ),
former::HashMapDefinition< String, Child, SuperFormer, SuperFormer, ParentSubformCollectionChildrenEnd< Definition > >,
>;

let echo = Child { name : "echo".to_string(), description : "prints all subjects and properties".to_string() };
let exit = Child { name : "exit".to_string(), description : "just exit".to_string() };
let ca = Parent::former()
Expand Down
4 changes: 2 additions & 2 deletions module/core/former/examples/former_custom_subform_entry2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn main()

if super_former.storage.child.is_none()
{
super_former.storage.child = Some( Default::default() );
super_former.storage.child = Some( HashMap::default() );
}

// add instance to the collection
Expand Down Expand Up @@ -100,7 +100,7 @@ fn main()

if super_former.storage.child.is_none()
{
super_former.storage.child = Some( Default::default() );
super_former.storage.child = Some( HashMap::default() );
}

// add instance to the collection
Expand Down
8 changes: 4 additions & 4 deletions module/core/former/examples/former_custom_subform_scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ fn main()

// Child struct with Former derived for builder pattern support
#[ derive( Debug, PartialEq, Former ) ]
// Optional: Use `#[debug]` to expand and debug generated code.
// #[debug]
// Optional: Use `#[ debug ]` to expand and debug generated code.
// #[ debug ]
pub struct Child
{
name : String,
Expand All @@ -47,8 +47,8 @@ fn main()

// Parent struct designed to hold a single Child instance using subform scalar
#[ derive( Debug, PartialEq, Former ) ]
// Optional: Use `#[debug]` to expand and debug generated code.
// #[debug]
// Optional: Use `#[ debug ]` to expand and debug generated code.
// #[ debug ]
pub struct Parent
{
// The `subform_scalar` attribute is used to specify that the 'child' field has its own former
Expand Down
Loading