Open kanerogers opened 1 year ago
I prefer yakui's current approach of exposing plain data which can be passed wherever. It's generally easier to dispatch data to different locations than it is to dispatch between traits, especially non-object-safe ones like the above.
I don't think we'd ever get rid of the way that the backends work today. I proposed that we implement a Graphics
trait like this to effectively use only as part of yakui-app
, to make it easier to test the examples across several backends.
That sounds good, but I remain uncertain how the above could be easier to work with than, say, fn(&PaintDom)
.
Motivation
Writing a Yakui renderer is pretty easy, as the
yakui-app
crate is simple and well documented. However, it would be even easier if there was a single trait that a renderer had to implement. This would also open the door to being able to easily test different backends.First draft trait
I'm not particularly good at writing generic Rust code, so I'm sure there's much easier ways to approach this. But something like this might be a good jumping off point: