Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Tr {
- fn trim_indent(&self) -> &Self;
- }
- impl Tr for str {
- fn trim_indent(&self) -> &Self {
- &self[..1] // some transformation here
- }
- }
- trait Tr1 {
- fn trim_indent(self) -> Self;
- }
- impl<'a> Tr1 for &'a str {
- fn trim_indent(self) -> Self {
- &self[..1] // some transformation here
- }
- }
- fn main() {
- let _: Box<Tr> = unimplemented!();
- let _: Box<Tr1> = unimplemented!();
- let func = <str as Tr>::trim_indent;
- let func = <&str as Tr1>::trim_indent;
- }
Add Comment
Please, Sign In to add comment