I need to write to a file from two places in my code -- I want to layer higher level functionality onto a lower level renderer which takes a Write
instance. My idea is to pass a Write
object in, get the lower-level renderer to write a chunk to the file, and then add some data to the file from another piece of code.
I could do this easily by having a single Write object that they both use, but referencing rules of rust stop me from doing this.
I can see various ways around this with an Rc
perhaps, but it seems an obvious requirement; I can't find any crates or anything in the standard library which addresses is. Am I missing anything?