#no-std

no-std impl-more

Concise trait implementations

5 releases

0.1.1 Oct 17, 2022
0.1.0 Oct 17, 2022
0.0.4 Oct 16, 2022
0.0.2 Sep 25, 2022
0.0.1 Sep 25, 2022

#66 in No standard library

Download history 99/week @ 2022-10-11 143/week @ 2022-10-18 136/week @ 2022-10-25 53/week @ 2022-11-01 211/week @ 2022-11-08 3/week @ 2022-11-15 41/week @ 2022-11-22 1/week @ 2022-11-29 178/week @ 2022-12-06 961/week @ 2022-12-13 924/week @ 2022-12-20 630/week @ 2022-12-27 1111/week @ 2023-01-03 1117/week @ 2023-01-10 1087/week @ 2023-01-17 918/week @ 2023-01-24

4,446 downloads per month
Used in 5 crates (via actix-web-lab)

MIT/Apache

28KB
528 lines

impl-more

Concise trait implementations.

crates.io Documentation MIT or Apache 2.0 licensed
dependency status Download CircleCI

Usage

struct MyNewTypeStruct(String);

impl_more::impl_as_ref!(MyNewTypeStruct => String);
impl_more::impl_as_mut!(MyNewTypeStruct => String);

impl_more::impl_deref!(MyNewTypeStruct => String);
impl_more::impl_deref_mut!(MyNewTypeStruct);
// or, to deref through String too:
// impl_more::forward_deref_and_mut!(MyNewTypeStruct, ref str);

impl_more::impl_from!(String => MyNewTypeStruct);
impl_more::impl_into!(MyNewTypeStruct => String);

enum MyEnum {
    Bar,
    Qux,
}

impl_more::impl_display_enum!(MyEnum, Bar => "bar", Qux => "qux");

enum Coords {
    Xy(i64, i64),
    Xyz(i64, i64, i64),
}

impl_more::impl_display_enum!(
    Coords,
    Xy(x, y) => "{x}, {y}",
    Xyz(x, y, z) => "{x}, {y}, {z}"
);

No runtime deps