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
7,806 downloads per month
Used in 22 crates
(4 directly)
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