chiark / gitweb /
Changed my mind about using Box<dyn TextFragment>.
I think it's going to be a better idea to have each user of
TextFragment separately make an enum that permits precisely the kinds
of TextFragment they want. Firstly, this means we can be statically
sure no rogue weird ones got in there by accident; secondly, it
immediately solves all the problems of finding the ones that need
special handling at render time (extensible-file indicators etc).
And thirdly - this is definitely a thing I'm having trouble getting
used to in Rust - if I _do_ need one particular client of TextFragment
to do everything by means of a list of perfectly generic Box<dyn
TextFragment>, I can choose to do it in _that_ client module, and
text.rs doesn't have to lift a finger to support it!