about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2019-08-31 11:22:51 -0400
committerMark Rousskov <mark.simulacrum@gmail.com>2019-09-07 19:31:58 -0400
commitf4a15ae3b248bf91f10f6e5d031ca84dc1942e19 (patch)
tree8a86909990c76fcddc8cfb30d05aa0c47aeadab0 /src/rustllvm/RustWrapper.cpp
parentf8bccb1658dce1b70e08c7c8f438b65f6f9bc139 (diff)
downloadrust-f4a15ae3b248bf91f10f6e5d031ca84dc1942e19.tar.gz
rust-f4a15ae3b248bf91f10f6e5d031ca84dc1942e19.zip
Implement Print for FnOnce(&mut Buffer)
This means that callers can pass in a closure like
`|buf| some_function(..., &mut buf)` and pass in arbitrary arguments to
that function without complicating the trait definition. We also keep
the impl for str and String, since it's useful to be able to just pass
in "" or format!("{}"...) results in some cases.

This changes Print's definition to take self, instead of &self, because
otherwise FnOnce cannot be called directly. We could instead take FnMut
or even Fn, but that seems like it'd merely complicate matters -- most
of the time, the FnOnce does not constrain us at all anyway. If it does,
a custom Print impl for &'_ SomeStruct is not all that painful.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions