The Rust documentation has a wonderful feature where you can click an icon for the source code examples and it will copy it to the clipboard.
Can this functionality be emulated in a LaTeX-generated PDF?
Bonus question: A few of the example snippets elide the main along with other uninteresting scaffolding for a particular example; see here. But when you click the copy button, the scaffolding and the main are present on the clipboard. Can this be emulated in a LaTex-generated PDF?