Cleaning buffer of BufWriter<File>

I know abot the "flush" method, but when cleaning, I don't want to write the data

I believe you want the into_parts method of BufWriter.

not really, I just need to reset the buffer

You're putting things into your writer you don't want to write ?

I make a text file editor, the user can change his mind to write

Ah, you don't want to use the Write trait at all then.

Use a rope data structure instead.

https://crates.io/crates/ropey

1 Like

thank you for helping to look at the problem from a different angle

Don't forget to learn about that data structure and adjacent data structures. Wikipedia is always a good start and follow the links.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.