Module powerletters

Source
Expand description

Concise single-letter methods for common operations.


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§

PowerClone
Power Clone.
PowerExpect
Power expect for Result and Option.
PowerToOwned
Power ToOwned.
PowerToString
Power ToString.
ResultIgnore
Power ignore Result - kick that Result to the curb!

Functions§

C
Power Clone.
I
Power ignore Result - kick that Result to the curb!
O
Power ToOwned.
S
Power ToString.
X
Power expect for Result and Option.