Skip to content

Commit 6ea14ee

Browse files
author
Andreas Auernhammer
committed
stabilize DecWriter and make writers closable
This commit does two things: - It makes the `DecWriter` the "inverse" type for `EncWriter`. This includes handling panic'ing of the inner writer, adding documentation, runnable examples a.s.o. - It introduces the `Close` trait which is implemented by `EncWriter` and `DecWriter`. Both should be closed explicatly after processing data to complete the en/decryption process and handle potential errors. (e.g. decryption fails) Now, the `flush` implementation of `EncWriter` and `DecWriter` only flushes the inner writer. An `EncWriter` or `DecWriter` cannot really be flushed since flushing the buffered data effectively means "creating" the final fragment such that no more data can be written. By only flushing the inner writer, `flush` can now be called multiple times and still cause e.g. writing any buffered (by the inner writer) out. If calling code want to complete the en/decryption it should call `close`.
1 parent 81714e9 commit 6ea14ee

File tree

1 file changed

+302
-62
lines changed

1 file changed

+302
-62
lines changed

0 commit comments

Comments
 (0)