[][src]Trait sio::Close

pub trait Close: Private {
    fn close(self) -> Result<()>;
}

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.

Loading content...

Implementors

impl<A: Algorithm, W: Write> Close for DecWriter<A, W>[src]

impl<A: Algorithm, W: Write> Close for EncWriter<A, W>[src]

Loading content...