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 |
#24 in #declare
6,054 downloads per month
Used in 21 crates
(3 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
~260–710KB
~17K SLoC