Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code shared from the Rust Playground
use std::io::Write;
struct Foo<W: Write> {
out: W,
}
impl<W: Write> Foo<W> {
fn exchange_out<W2: Write>(self, new: W2) -> (Foo<W2>, W) {
let Foo { out } = self;
(Foo { out: new }, out )
}
}
fn main() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment