[−][src]Attribute Macro easy_ext::ext
#[ext]
An attribute macro for easily writing extension trait pattern.
Examples
use easy_ext::ext; #[ext(ResultExt)] impl<T, E> Result<T, E> { fn err_into<U>(self) -> Result<T, U> where E: Into<U>, { self.map_err(Into::into) } }
Code like this will be generated:
trait ResultExt<T, E> { fn err_into<U>(self) -> Result<T, U> where E: Into<U>; } impl<T, E> ResultExt<T, E> for Result<T, E> { fn err_into<U>(self) -> Result<T, U> where E: Into<U>, { self.map_err(Into::into) } }
Supported items
Visibility
-
The generated extension trait inherits the visibility of the item in the original
impl. -
The visibility of all the items in the original
implmust be identical.