Skip to content

Commit

Permalink
Merge pull request #1241 from Wandalen/former_usability_2
Browse files Browse the repository at this point in the history
READY : Better usability of Former
  • Loading branch information
Wandalen authored May 11, 2024
2 parents f0be1f5 + 21829bb commit c7925cc
Show file tree
Hide file tree
Showing 226 changed files with 15,875 additions and 6,754 deletions.
15 changes: 13 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,17 @@ path = "module/core/for_each"
default-features = false

[workspace.dependencies.former]
version = "~0.16.0"
version = "~1.0.0"
path = "module/core/former"
default-features = false

[workspace.dependencies.former_stable]
package = "former"
version = "=0.15.0"
default-features = false

[workspace.dependencies.former_meta]
version = "~0.14.0"
version = "~1.0.0"
path = "module/core/former_meta"
default-features = false

Expand Down Expand Up @@ -324,6 +329,7 @@ default-features = false
version = "~0.2.0"
path = "module/alias/wstring_tools"


## fs tools / path tools

[workspace.dependencies.fs_tools]
Expand All @@ -349,6 +355,11 @@ version = "~0.3.0"
path = "module/core/process_tools"
default-features = false

[workspace.dependencies.process_tools_published]
package = "process_tools"
version = "~0.2.0"
default-features = false


## test

Expand Down
34 changes: 34 additions & 0 deletions module/blank/rustql/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[package]
name = "rustql"
version = "0.1.0"
edition = "2021"
authors = [
"Kostiantyn Wandalen <[email protected]>",
]
license = "MIT"
readme = "Readme.md"
documentation = "https://docs.rs/rustql"
repository = "https://github.com/Wandalen/wTools/tree/master/module/core/rustql"
homepage = "https://github.com/Wandalen/wTools/tree/master/module/core/rustql"
description = """
Rust query language.
"""
categories = [ "algorithms", "development-tools" ]
keywords = [ "fundamental", "general-purpose" ]

[lints]
workspace = true

[package.metadata.docs.rs]
features = [ "full" ]
all-features = false

[features]
default = [ "enabled" ]
full = [ "enabled" ]
enabled = []

[dependencies]

[dev-dependencies]
test_tools = { workspace = true }
22 changes: 22 additions & 0 deletions module/blank/rustql/License
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright Kostiantyn W and Out of the Box Systems (c) 2013-2024

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
33 changes: 33 additions & 0 deletions module/blank/rustql/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!-- {{# generate.module_header{} #}} -->

# Module :: rustql
[![experimental](https://raster.shields.io/static/v1?label=stability&message=experimental&color=orange&logoColor=eee)](https://github.com/emersion/stability-badges#experimental) [![rust-status](https://github.com/Wandalen/wTools/actions/workflows/ModulerustqlPush.yml/badge.svg)](https://github.com/Wandalen/wTools/actions/workflows/ModulerustqlPush.yml) [![docs.rs](https://img.shields.io/docsrs/rustql?color=e3e8f0&logo=docs.rs)](https://docs.rs/rustql) [![discord](https://img.shields.io/discord/872391416519737405?color=eee&logo=discord&logoColor=eee&label=ask)](https://discord.gg/m3YfbXpUUY)

Rust query language.

<!--
### Basic use-case
```rust
use rustql::*;
fn main()
{
}
```
### To add to your project
```bash
cargo add rustql
```
### Try out from the repository
``` shell test
git clone https://github.com/Wandalen/wTools
cd wTools
cargo run --example rustql_trivial
cargo run
```
-->
11 changes: 11 additions & 0 deletions module/blank/rustql/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#![ cfg_attr( feature = "no_std", no_std ) ]
#![ doc( html_logo_url = "https://raw.githubusercontent.com/Wandalen/wTools/master/asset/img/logo_v3_trans_square.png" ) ]
#![ doc( html_favicon_url = "https://raw.githubusercontent.com/Wandalen/wTools/alpha/asset/img/logo_v3_trans_square_icon_small_v2.ico" ) ]
#![ doc( html_root_url = "https://docs.rs/rustql/latest/rustql/" ) ]
#![ doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "Readme.md" ) ) ]

/// Function description.
#[ cfg( feature = "enabled" ) ]
pub fn f1()
{
}
7 changes: 7 additions & 0 deletions module/blank/rustql/tests/inc/basic_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[ allow( unused_imports ) ]
use super::*;

#[ test ]
fn basic()
{
}
4 changes: 4 additions & 0 deletions module/blank/rustql/tests/inc/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#[ allow( unused_imports ) ]
use super::*;

mod basic_test;
14 changes: 14 additions & 0 deletions module/blank/rustql/tests/smoke_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

// #[ cfg( feature = "default" ) ]
#[ test ]
fn local_smoke_test()
{
::test_tools::smoke_test_for_local_run();
}

// #[ cfg( feature = "default" ) ]
#[ test ]
fn published_smoke_test()
{
::test_tools::smoke_test_for_published_run();
}
10 changes: 10 additions & 0 deletions module/blank/rustql/tests/tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

include!( "../../../../module/step/meta/src/module/terminal.rs" );

#[ allow( unused_imports ) ]
use rustql as the_module;
#[ allow( unused_imports ) ]
use test_tools::exposed::*;

#[ cfg( feature = "enabled" ) ]
mod inc;
2 changes: 1 addition & 1 deletion module/core/clone_dyn/tests/inc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ tests_impls!
#[ clone_dyn ]
trait Trait2< T1 : Copy, T2 : Copy >
where
T2 : Clone + std::fmt::Debug,
T2 : Clone + core::fmt::Debug,
{
}

Expand Down
10 changes: 5 additions & 5 deletions module/core/clone_dyn_meta/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn clone_dyn( _attr : proc_macro::TokenStream, item : proc_macro::TokenStrea
let name_ident = &item_parsed.ident;
// let generics = &item_parsed.generics;
let generics_analyzed = item_parsed.generics_analyze();
let generics_params = &generics_analyzed.generics.params;
let generic_params = &generics_analyzed.generics.params;
let generics_where = &generics_analyzed.generics.where_clause;
let generics_names = &generics_analyzed.names;

Expand All @@ -25,7 +25,7 @@ pub fn clone_dyn( _attr : proc_macro::TokenStream, item : proc_macro::TokenStrea
#item_parsed

#[ allow( non_local_definitions ) ]
impl < 'c, #generics_params > Clone
impl < 'c, #generic_params > Clone
for Box< dyn #name_ident< #( #generics_names ),* > + 'c >
// where
#generics_where
Expand All @@ -35,7 +35,7 @@ pub fn clone_dyn( _attr : proc_macro::TokenStream, item : proc_macro::TokenStrea
}

#[ allow( non_local_definitions ) ]
impl < 'c, #generics_params > Clone
impl < 'c, #generic_params > Clone
for Box< dyn #name_ident< #( #generics_names ),* > + Send + 'c >
// where
#generics_where
Expand All @@ -45,7 +45,7 @@ pub fn clone_dyn( _attr : proc_macro::TokenStream, item : proc_macro::TokenStrea
}

#[ allow( non_local_definitions ) ]
impl < 'c, #generics_params > Clone
impl < 'c, #generic_params > Clone
for Box< dyn #name_ident< #( #generics_names ),* > + Sync + 'c >
// where
#generics_where
Expand All @@ -55,7 +55,7 @@ pub fn clone_dyn( _attr : proc_macro::TokenStream, item : proc_macro::TokenStrea
}

#[ allow( non_local_definitions ) ]
impl < 'c, #generics_params > Clone
impl < 'c, #generic_params > Clone
for Box< dyn #name_ident< #( #generics_names ),* > + Send + Sync + 'c >
// where
#generics_where
Expand Down
2 changes: 1 addition & 1 deletion module/core/collection_tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ collection_constructors = []
collection_into_constructors = []
# STD collection for no_std.
collection_std = []

# qqq : is this feature used? seems not. if yes, what is it responsible for? discuss

[dependencies]

Expand Down
6 changes: 6 additions & 0 deletions module/core/collection_tools/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ Instead of
<summary>Click to see</summary>

```rust
# #[ cfg( all( feature = "enabled", feature = "collection_std" ) ) ]
# #[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ]
# {

#[ cfg( feature = "use_alloc" ) ]
use hashbrown::HashSet; // a `no_std` replacement for `HashSet`
#[ cfg( not( feature = "no_std" ) ) ]
Expand All @@ -102,6 +106,8 @@ use std::collections::HashSet;
let mut vec : HashSet< i32 > = HashSet::new();
vec.insert( 1 );
assert_eq!( vec.contains( &1 ), true );

# }
```

</details>
Expand Down
8 changes: 4 additions & 4 deletions module/core/collection_tools/src/constructors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ macro_rules! heap
/// Creates a `HashMap` from a list of key-value pairs.
///
/// The `hmap` macro allows for convenient creation of a `HashMap` with initial elements.
///
///
/// # Origin
///
/// This collection can be reexported from different crates:
Expand Down Expand Up @@ -276,9 +276,9 @@ macro_rules! hmap
/// Creates a `HashSet` from a list of elements.
///
/// The `hset` macro allows for convenient creation of a `HashSet` with initial elements.
///
///
/// # Origin
///
///
/// This collection can be reexported from different crates:
/// - from `std`, if `no_std` flag if off
/// - from `hashbrown`, if `use_alloc` flag if on
Expand Down Expand Up @@ -354,7 +354,7 @@ macro_rules! hset
///
/// The `list` macro facilitates the creation of a `LinkedList` with initial elements.
///
///
///
/// # Origin
///
/// This collection is reexported from `alloc`.
Expand Down
65 changes: 38 additions & 27 deletions module/core/collection_tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,35 @@
#![ doc( html_root_url = "https://docs.rs/collection_tools/latest/collection_tools/" ) ]
#![ doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "Readme.md" ) ) ]

// qqq : make subdirectory for each container

// qqq : move out of lib.rs file
/// Not meant to be called directly.
#[ doc( hidden ) ]
#[ macro_export( local_inner_macros ) ]
macro_rules! count
{
( @single $( $x : tt )* ) => ( () );

(
@count $( $rest : expr ),*
)
=>
(
< [ () ] >::len( &[ $( count!( @single $rest ) ),* ] )
);
}

/// Macros to construct the collections.
/// Basically a tweaked version of `literally` crate but using `alloc` / `hashbrown` instead of `std`
#[ cfg( all( feature = "enabled", feature = "collection_constructors" ) ) ]
pub mod constructors;

/// Macros to construct the collections, using `.into()` under the hood.
/// Often requires explicitly specifying type to cast to.
#[ cfg( all( feature = "enabled", feature = "collection_into_constructors" ) ) ]
pub mod into_constructors;

/// Namespace with dependencies.
#[ cfg( feature = "enabled" ) ]
pub mod dependency
Expand All @@ -28,21 +57,30 @@ pub mod protected
#[ allow( unused_imports ) ]
pub use super::orphan::*;

// #[ cfg( feature = "use_alloc" ) ]
extern crate alloc;

// #[ cfg( feature = "use_alloc" ) ]
#[ doc( inline ) ]
#[ allow( unused_imports ) ]
pub use alloc::vec::Vec;

// #[ cfg( feature = "use_alloc" ) ]
#[ doc( inline ) ]
#[ allow( unused_imports ) ]
pub use alloc::collections::{ BinaryHeap, BTreeMap, BTreeSet, LinkedList, VecDeque };

// qqq : what is comnination `use_alloc` + !`no_std`
#[ cfg( feature = "use_alloc" ) ]
#[ doc( inline ) ]
#[ allow( unused_imports ) ]
pub use hashbrown::{ HashMap, HashSet };

#[ cfg( not( feature = "no_std" ) ) ]
#[ doc( inline ) ]
#[ allow( unused_imports ) ]
pub use std::collections::{ HashMap, HashSet };

}

/// Parented namespace of the module.
Expand Down Expand Up @@ -76,30 +114,3 @@ pub mod prelude
#[ allow( unused_imports ) ]
pub use super::into_constructors::*;
}

/// Not meant to be called directly.
#[ doc( hidden ) ]
#[ macro_export( local_inner_macros ) ]
macro_rules! count
{
( @single $( $x : tt )* ) => ( () );

(
@count $( $rest : expr ),*
)
=>
(
< [ () ] >::len( &[ $( count!( @single $rest ) ),* ] )
);
}


/// Macros to construct the collections.
/// Basically a tweaked version of `literally` crate but using `alloc` / `hashbrown` instead of `std`
#[ cfg( all( feature = "enabled", feature = "collection_constructors" ) ) ]
pub mod constructors;

/// Macros to construct the collections, using `.into()` under the hood.
/// Often requires explicitly specifying type to cast to.
#[ cfg( all( feature = "enabled", feature = "collection_into_constructors" ) ) ]
pub mod into_constructors;
2 changes: 2 additions & 0 deletions module/core/collection_tools/src/vec.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

pub use core::slice::Iter
Loading

0 comments on commit c7925cc

Please sign in to comment.