::ext-trait
Also
```rust ,no_run
extern crate ext_trait;
impl
fn main () { use ::std::{collections::HashMap, ops::Not};
let /* immut */ map = HashMap::with_capacity(2).also(|m| {
m.insert("foo", 42);
m.insert("bar", 27);
});
assert!(map.contains_key("foo"));
assert!(map.contains_key("bar"));
assert!(map.contains_key("baz").not());
} ```
WithPath
```rust ,no_run
extern crate ext_trait;
use ::std::{error::Error, path::{Path, PathBuf}};
impl PathBuf {
fn with (mut self, segment: impl AsRef
fn main ()
-> Result<(), Box
Context
```rust ,no_run
extern crate ext_trait;
use ::std::{error::Error, fmt::Display};
impl
fn main ()
-> Result<(), Box
Similar to https://docs.rs/extension-trait, but for the following:
Supports generics (see Context
)
search/grep 'trait TraitName'
-friendly!