Skip to main content

strs_tools/
lib.rs

1#![ cfg_attr( all( feature = "no_std", not( feature = "std" ) ), no_std ) ]
2#![ doc( html_logo_url = "https://raw.githubusercontent.com/Wandalen/wTools/master/asset/img/logo_v3_trans_square.png" ) ]
3#![ doc
4(
5  html_favicon_url = "https://raw.githubusercontent.com/Wandalen/wTools/alpha/asset/img/logo_v3_trans_square_icon_small_v2.ico"
6) ]
7#![ doc( html_root_url = "https://docs.rs/strs_tools/latest/strs_tools/" ) ]
8#![ cfg_attr( doc, doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "readme.md" ) ) ) ]
9#![ cfg_attr( not( doc ), doc = "String manipulation utilities" ) ]
10#![ allow( clippy::std_instead_of_alloc ) ]
11#![ allow( clippy::must_use_candidate ) ]
12#![ allow( clippy::elidable_lifetime_names ) ]
13#![ allow( clippy::std_instead_of_core ) ]
14#![ allow( clippy::manual_strip ) ]
15#![ allow( clippy::doc_markdown ) ]
16#![ allow( clippy::new_without_default ) ]
17#![ allow( clippy::clone_on_copy ) ]
18#![ allow( clippy::single_match_else ) ]
19#![ allow( clippy::return_self_not_must_use ) ]
20#![ allow( clippy::match_same_arms ) ]
21#![ allow( clippy::missing_panics_doc ) ]
22#![ allow( clippy::missing_errors_doc ) ]
23#![ allow( clippy::iter_cloned_collect ) ]
24#![ allow( clippy::redundant_closure ) ]
25#![ allow( clippy::uninlined_format_args ) ]
26
27//! # Rule Compliance & Architectural Notes
28//!
29//! This crate has been systematically updated to comply with the Design and Codestyle Rulebooks.
30//! Key compliance achievements and ongoing considerations :
31//!
32//! ## Completed Compliance Work :
33//!
34//! 1. **Documentation Strategy** : Uses `#![ doc = include_str!(...) ]` to include readme.md
35//!    instead of duplicating documentation. This is the mandated approach for all entry files.
36//!
37//! 2. **Workspace Dependencies** : All external dependencies now inherit from workspace with
38//!    `{ workspace = true }`. SIMD optimization deps (memchr, aho-corasick, bytecount, lexical)
39//!    were moved to workspace level for version consistency.
40//!
41//! 3. **Attribute Formatting** : All attributes use proper spacing per Universal Formatting Rule :
42//!    `#[ cfg( feature = "enabled" ) ]` instead of `#[ cfg( feature = "enabled" ) ]`
43//!
44//! 4. **Manual Namespace Architecture** : Uses the standard wTools manual namespace pattern
45//!    (private/own/orphan/exposed/prelude) for precise API control and stable public interfaces.
46//!
47//! ## Critical Architectural Decisions :
48//!
49//! - **Feature Gating** : All functionality is gated behind the "enabled" feature for
50//!   granular control over compilation and dependencies.
51//!
52//! - **Error Handling** : Uses `error_tools` exclusively - no `anyhow` or `thiserror` dependencies
53//!   per Design Rulebook requirements.
54//!
55//! - **Testing Isolation** : All tests are in `tests/` directory, never in `src/`, following
56//!   the mandatory testing architecture pattern.
57
58#[ cfg( all( feature = "use_alloc", not( feature = "std" ) ) ) ]
59#[ allow( unused_extern_crates ) ]
60extern crate alloc;
61
62/// String tools.
63#[ cfg( feature = "enabled" ) ]
64pub mod string;
65
66/// SIMD-optimized string operations.
67#[ cfg( all( feature = "enabled", feature = "simd" ) ) ]
68pub mod simd;
69
70/// ANSI escape sequence handling utilities.
71#[ cfg( all( feature = "enabled", feature = "ansi" ) ) ]
72pub mod ansi;
73
74/// Re-export compile-time optimization macros.
75#[ cfg( all( feature = "enabled", feature = "compile_time_optimizations" ) ) ]
76#[ allow( unused_imports ) ]
77pub use strs_tools_meta::*;
78
79#[ doc( inline ) ]
80#[ allow( unused_imports ) ]
81#[ cfg( feature = "enabled" ) ]
82pub use own::*;
83
84/// Own namespace of the module.
85#[ cfg( feature = "enabled" ) ]
86#[ allow( unused_imports ) ]
87pub mod own
88{
89  #[ allow( unused_imports ) ]
90  use super::*;
91  pub use orphan::*;
92  pub use super::string;
93  #[ cfg( feature = "simd" ) ]
94  pub use super::simd;
95  #[ cfg( feature = "ansi" ) ]
96  pub use super::ansi;
97  #[ cfg( test ) ]
98  pub use super::string::orphan::*;
99}
100
101/// Parented namespace of the module.
102#[ cfg( feature = "enabled" ) ]
103#[ allow( unused_imports ) ]
104pub mod orphan
105{
106  #[ allow( unused_imports ) ]
107  use super::*;
108  pub use exposed::*;
109}
110
111/// Exposed namespace of the module.
112#[ cfg( feature = "enabled" ) ]
113#[ allow( unused_imports ) ]
114pub mod exposed
115{
116  #[ allow( unused_imports ) ]
117  use super::*;
118  pub use prelude::*;
119  pub use super::string::exposed::*;
120}
121
122/// Namespace of the module to include with `use module::*`.
123#[ cfg( feature = "enabled" ) ]
124#[ allow( unused_imports ) ]
125pub mod prelude
126{
127  #[ allow( unused_imports ) ]
128  use super::*;
129  pub use super::string::prelude::*;
130}