btypes-0.3.8 has been yanked.
btypes
A Rust library providing enhanced types with rich functionality for string manipulation and boolean state management, with more types coming soon.
Key Features
BetterString
A feature-rich string type offering:
- Validation for common formats:
- Email addresses
- URLs
- IPv4 addresses
- Pattern matching with regex support
- Encoding/decoding:
- Base64
- URL encoding
- String operations:
- Concatenation using
+operator - Arithmetic operations:
*repeats a string N times/counts occurrences-removes a substring/=keeps only the first occurrence
- Case transformations
- Pattern finding and replacement
- Safe UTF-8 handling
- Comprehensive iterator support
- Rich comparison operations
- Concatenation using
Boolean Types
Two main categories with multiple capacity options:
Named Boolean Types (Fixed Capacity)
BN128: 128-bit capacityBN64: 64-bit capacityBN32: 32-bit capacityBN16: 16-bit capacityBN8: 8-bit capacity
Infinite Capacity Boolean Types
BNInf: Effectively infinite capacity using dynamic allocation- Custom types supported via
NumsandBitwiseOpsClone/BitwiseOpsCopytraits
Features include:
- Named boolean state management
- Raw binary access and manipulation
- Mass operations with pattern-based flag setting
- Sorting capabilities
- Comprehensive error handling
- Safe and unsafe operation modes
- Iterator support
- Clone and Copy semantics where applicable
Usage Examples
String Operations
use BetterString;
Boolean State Management
use BN128;
Infinite Boolean Management
use BNInf;
Feature Flags
bools: Basic boolean typesnamed_bools: Enable named boolean typesstrings: String enhancement functionalityinf_bools: Infinite capacity boolean typesinf_named_bools: Named infinite capacity boolean typesall: Enable all features
Examples
Full working examples available in:
/examples/string_ex.rs: String manipulation demonstrations/examples/bool_ex.rs: Advanced boolean operations/examples/low_cap_bool_ex.rs: Different capacity boolean types/examples/inf_cap_bool_ex.rs: Infinite capacity boolean operations
License
Licensed under GPL-3.0
Contributing
Contributions are welcome! Please feel free to submit:
- Pull requests
- Bug reports
- Feature suggestions
- Documentation improvements