11 releases (3 stable)

1.0.2 Mar 20, 2023
1.0.1 Jan 27, 2022
1.0.0 Jan 1, 2021
0.2.3 Nov 16, 2020
0.1.2 Nov 5, 2017

#21 in #declare

Download history 1959/week @ 2024-07-23 1933/week @ 2024-07-30 1195/week @ 2024-08-06 1441/week @ 2024-08-13 1295/week @ 2024-08-20 1192/week @ 2024-08-27 1118/week @ 2024-09-03 1574/week @ 2024-09-10 1687/week @ 2024-09-17 1448/week @ 2024-09-24 1703/week @ 2024-10-01 1149/week @ 2024-10-08 1698/week @ 2024-10-15 2539/week @ 2024-10-22 1705/week @ 2024-10-29 1671/week @ 2024-11-05

7,806 downloads per month
Used in 22 crates (4 directly)

MIT/Apache

9KB
152 lines

extension-trait

A macro to declare extension traits - a trait that is created to add methods to an external type.

Example

#[macro_use]
extern crate extension_trait;

#[extension_trait]
pub impl DoubleExt for str {
   fn double(&self) -> String {
       self.repeat(2)
   }
}

fn main() {
    assert_eq!("Hello".double(), "HelloHello");
}

Dependencies

~205–640KB
~15K SLoC