| Crates.io | extension-trait |
| lib.rs | extension-trait |
| version | 1.0.2 |
| created_at | 2017-11-04 22:11:48.63058+00 |
| updated_at | 2023-03-20 15:10:11.163878+00 |
| description | Macro to declare extension traits |
| homepage | |
| repository | https://gitlab.com/KonradBorowski/extension-trait |
| max_upload_size | |
| id | 38167 |
| size | 23,693 |
A macro to declare extension traits - a trait that is created to add methods to an external type.
#[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");
}