Expand description
Concise single-letter methods for common operations.
- Crate
::powerletters
. - docs.rs
- crates.io
- GitHub
powerletters
provides single-letter methods for common Rust operations,
offering concise alternatives to standard trait methods.
The crate defines extension traits that add methods like C
for cloning,
O
for converting to owned types, S
for converting to strings,
I
for ignoring results, and X
for expecting values.
These methods can be used both as method calls on values and as standalone functions, providing flexibility in different coding contexts.
§Examples
Cloning with C
:
use powerletters::*;
let vec = vec![1, 2, 3];
let cloned = vec.C();
assert_eq!(vec, cloned);
Converting to string with S
:
use powerletters::*;
let num = 42;
let s = num.S();
assert_eq!(s, "42");
Ignoring a result with I
:
use powerletters::*;
use std::io::Write;
let mut vec = Vec::new();
write!(vec, "hello").I();
Traits§
- Power
Clone - Power
Clone
. - Power
Expect - Power
expect
forResult
andOption
. - Power
ToOwned - Power
ToOwned
. - Power
ToString - Power
ToString
. - Result
Ignore - Power ignore
Result
- kick thatResult
to the curb!