Stebalien / term

A Rust library for terminfo parsing and terminal colors.
https://stebalien.github.io/doc/term/term/
Apache License 2.0
178 stars 49 forks source link

How to store and pass around `Terminal` of any type. #70

Open dpc opened 7 years ago

dpc commented 7 years ago

Hi,

I wonder how to store and pass around Terminal of any type: no matter if it logs to stdout, stder, on Windows, or elsewhere. Like Box<Terminal>, that because of type Output seems currently impossible. I wish I could have Box<Terminal<Output=Write>> or something like that.

Am I missing something, and if not, could some solution for this be provided?

dpc commented 7 years ago

If it's only stdout and stderr to ever be supported, I guess a simple enum that implements Write would do.

Stebalien commented 7 years ago

Hmm... yes, that's rather annoying. Unfortunately, I can't think of a backwards compatible way to fix it but I'll consider fixing it in a backwards incompatible release. In the meantime, we don't plan on adding more terminal types (in this version of term) so you could always implement that enum.

Worse, this is my fault: https://github.com/Stebalien/term/pull/29 😢.

dpc commented 7 years ago

It's not blocking me or anything, just a feature request then. :)

Our lives are full of API regrets sealed by semver restrictions. :D