Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Foo<'a> {
- bar: &'a str,
- }
- impl<'a> Into<String> for Foo<'a> {
- fn into(self) -> String {
- String::from(self.bar)
- }
- }
- fn main() {
- let f: Foo = Foo { bar: "bar" };
- assert_eq!("bar", f.into());
- }
Add Comment
Please, Sign In to add comment