Crates.io | btypes |
lib.rs | btypes |
version | |
source | src |
created_at | 2024-11-22 23:58:59.731567 |
updated_at | 2024-11-24 02:18:44.581035 |
description | Better types (BTypes) for when you dislike normal types, I guess. |
homepage | |
repository | https://github.com/afemboylol/btypes |
max_upload_size | |
id | 1458017 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
A Rust library providing enhanced types with rich functionality for string manipulation and boolean state management, with more types coming soon.
A feature-rich string type offering:
+
operator*
repeats a string N times/
counts occurrences-
removes a substring/=
keeps only the first occurrenceTwo main categories with multiple capacity options:
BN128
: 128-bit capacityBN64
: 64-bit capacityBN32
: 32-bit capacityBN16
: 16-bit capacityBN8
: 8-bit capacityBNInf
: Effectively infinite capacity using dynamic allocationNums
and BitwiseOpsClone
/BitwiseOpsCopy
traitsFeatures include:
use btypes::bstring::BetterString;
fn main() {
// Basic creation and manipulation
let mut str1 = BetterString::new("Hello, World!");
println!("Original: {}", str1);
println!("Uppercase: {}", str1.to_uppercase());
// Pattern matching and validation
let email = BetterString::new("user@example.com");
println!("Valid email: {}", email.is_valid_email());
// Encoding operations
let encoded = str1.to_base64();
println!("Base64: {}", encoded);
// Pattern matching and replacement
let text = BetterString::new("The quick brown fox");
let matches = text.find_all(r"\w+");
println!("Words: {:?}", matches);
}
use btypes::named_bools::BN128;
fn main() -> anyhow::Result<()> {
let mut state = BN128::new();
// Individual state management
state.set("is_active", true)?;
state.set("is_validated", false)?;
// Mass operations
state.mass_set(4, "flag_{n}", "true,false{r}")?;
// State querying
println!("Active: {}", state.get("is_active")?);
println!("All states: {:?}", state.all()?);
Ok(())
}
use btypes::inf_named_bools::BNInf;
fn main() -> anyhow::Result<()> {
let mut state = BNInf::new();
// Can handle very large numbers of flags
state.mass_set(1000, "flag_{n}", "true,false{r}")?;
// Efficient state management
println!("States: {:?}", state.all()?);
Ok(())
}
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 featuresFull 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 operationsLicensed under GPL-3.0
Contributions are welcome! Please feel free to submit: