Implementing methods / utilities for rust primitive types
Please keep in mind that I am not a rust wizard and this methods may not be blazingly fast or may not follow the best practices
Installation
Add this to your Cargo.toml
[]
# if you want methods for a specific type then add them as a feature
= { = "0.1.0", = ["strings", "bool"] }
# features currently available:
# strings, bool, vec
And bring the traits to scope like this:
use *;
Strings
so far, for strings String
and &str
I have implemented:
string.first()
Examples
use crate SelectNth;
let case1 = String from;
assert_eq!;
let case2 = String from;
assert_eq!;
string.remove_whitespaces()
Examples
use crate RemoveWhitespaces;
let case1 = String from;
assert_eq!;
let case2 = String from;
assert_eq!;
string.to_snake_case()
Examples
use crate ToCases;
let case1 = String from;
assert_eq!;
let case2 = String from;
assert_eq!;
string.to_camel_case()
Examples
use crate ToCases;
let case1 = String from;
assert_eq!;
let case2 = String from;
assert_eq!;
let case3 = String from;
assert_eq!;
string.to_pascal_case()
Examples
use crate ToCases;
let case1 = String from;
assert_eq!;
let case2 = String from;
assert_eq!;
let case3 = String from;
assert_eq!;
Bool
so far, for bool
I have implemented:
bool.toggle()
use crate*;
Vec
so far, for Vec<T> where T: PartialEq + Clone
I have implemented: