Crates.io | extend |
lib.rs | extend |
version | 1.2.0 |
source | src |
created_at | 2019-10-30 23:03:22.812708 |
updated_at | 2023-03-18 20:13:19.230021 |
description | Create extensions for types you don't own with extension traits but without the boilerplate. |
homepage | https://github.com/davidpdrsn/extend |
repository | https://github.com/davidpdrsn/extend |
max_upload_size | |
id | 177061 |
size | 33,691 |
Create extensions for types you don't own with extension traits but without the boilerplate.
Example:
use extend::ext;
#[ext]
impl<T: Ord> Vec<T> {
fn sorted(mut self) -> Self {
self.sort();
self
}
}
fn main() {
assert_eq!(
vec![1, 2, 3],
vec![2, 3, 1].sorted(),
);
}