Right now, we use locking and a mutable reference to the target to output stuff. This is not very nice, but allows us to work around using termcolor for Windows support.
Targets can receive multiple messages per item to print, and each message will need to own its data (or be 'static). Another approach would be to have one message per item that contains a vector of control instructions, that the target get execute to get the wanted output.
For human output, I'm thinking of a structure like this:
enumPart{Command(Cmd),// Option 1: Just send owned stringsContent(String),// Option 2: Use a buffer in the StringArea and refer to slices of itContent{start:usize,end:usize},}structStringArena{content:Vec<Part>// For option 2:
buffer:String,}enumCmd{ResetStyle,Bold,Underline,Foreground(Color),Background(Color),ClearLine,}structColor(termcolor::Color)Option 2 would have the additional advantage of being trivial to convert to plain-text – just return the string buffer.
Right now, we use locking and a mutable reference to the target to output stuff. This is not very nice, but allows us to work around using termcolor for Windows support.
Targets can receive multiple messages per item to print, and each message will need to own its data (or be
'static). Another approach would be to have one message per item that contains a vector of control instructions, that the target get execute to get the wanted output.For human output, I'm thinking of a structure like this:
Option 2 would have the additional advantage of being trivial to convert to plain-text – just return the string buffer.