Guest User

Untitled

a guest
May 28th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. struct Foo<'a> {
  2. bar: &'a str,
  3. }
  4.  
  5. impl<'a> Into<String> for Foo<'a> {
  6. fn into(self) -> String {
  7. String::from(self.bar)
  8. }
  9. }
  10.  
  11. fn main() {
  12. let f: Foo = Foo { bar: "bar" };
  13. assert_eq!("bar", f.into());
  14. }
Add Comment
Please, Sign In to add comment