2 releases

0.1.1 May 28, 2021
0.1.0 May 28, 2021

#2 in #subtract

0BSD license

12KB
279 lines

switchstring

it's a string, but unlike a string where you can add substrings, you can subtract substrings here as well. it is thus a switchstring

why

to make mathematicians (and maybe you) suffer of the knowledge that this exists

how

use switchstring::Switchstring;

let a = "I promise I love maths";
let b = "maths";
let c = "cute rustaceans such as ferris";
let d: Switchstring = "I promise ".into();
let improved = String::from(-d + a - b + c);
assert_eq!("I love cute rustaceans such as ferris", improved);

lib.rs:

strings you can subtract

i promise this is something you need in your life, $100%

example

use switchstring::Switchstring;

let a = "I promise I love maths";
let b = "maths";
let c = "cute rustaceans such as ferris";
let d: Switchstring = "I promise ".into();
let improved = String::from(-d + a - b + c);
assert_eq!("I love cute rustaceans such as ferris", improved);

No runtime deps