Crate powerletters
Power Letters for Rust
Concise spellings of common Rust operations:
C-CloneO-ToOwnedS-ToStringI- IgnoreResultX-expectforResultandOption
All operations are provided as both functions and methods. Sometimes one reads better than the other.
Power Clone
use *;
let bagostuff = vec!;
let newbag = bagostuff.C;
// or
let newbag = C;
Power ToOwned
use *;
use Path;
let yourpath = new;
let mypath = yourpath.O;
// or
let mypath = O;
Power ToString
use *;
let s: String = S;
// or
let s: String = "foo".S;
Power ignore Result - kick that Result to the curb!
use *;
use Write;
let mut buf = Vecnew;
write!.I;
// or
I;
Note this is superior to let _ = ...
because the let version is untyped and can
introduce unintended bugs like ignoring futures.
Power expect for Result and Option.
use *;
# use io;
let maybe_thing = Some;
let thing = maybe_thing.X; // like `.expect("some baloney")`
let good_thing: = Ok;
let thing = good_thing.X;
// or
let maybe_thing = Some;
let thing = X;
let good_thing: = Ok;
let thing = X;
Traits
-
PowerClone
Power
Clone. -
PowerExpect
Power
expectforResultandOption. -
PowerToOwned
Power
ToOwned. -
PowerToString
Power
ToString. -
ResultIgnore
Power ignore
Result- kick thatResultto the curb!