[−][src]Trait sio::Close
A trait for objects which should be closed before they are dropped and may fail doing so.
Both, the EncWriter
and DecWriter
encrypt resp. decrypt the last
fragment differently than any previous fragment. Therefore they should
be closed to trigger the en/decryption of the last fragment. If not
done explicitly an EncWriter
resp. DecWriter
gets closed when it
gets dropped. However, e.g. decrypting the final fragment may fail
because it may not be authentic, and therefore, calling code should
such potential errors. Therefore, callers should always call close
after using an EncWriter
or DecWriter
.
At the moment implementing Close
also requires implementing a
private trait such that it cannot be implemented by any type
outside sio
.
Required methods
fn close(self) -> Result<()>
Tries to close the byte-oriented sinks such that no further operation should succeed. Therefore it consumes the sink.