RwBuilder

Trait RwBuilder 

Source
pub trait RwBuilder
where Self: Sized, Self::Reader: Read, Self::Writer: Write,
{ type Reader; type Writer; // Required methods fn reader(&self) -> Result<Self::Reader>; fn writer(&self) -> Result<Self::Writer>; // Provided methods fn buffered(self) -> BufferedBuilder<Self> { ... } fn string(self) -> Builder<Self> { ... } fn bincode(self) -> BincodeBuilder<Self> { ... } fn chacha20( self, key: ChaCha20Key, nonce: ChaCha20Nonce, ) -> ChaCha20Builder<Self> { ... } fn salsa20( self, key: Salsa20Key, nonce: Salsa20Nonce, ) -> Salsa20Builder<Self> { ... } fn crc(self) -> CrcBuilder<Self> { ... } fn deflate( self, compression: Compression, ) -> CompressionBuilder<Self, Deflate> { ... } fn gz(self, compression: Compression) -> CompressionBuilder<Self, Gz> { ... } fn zlib(self, compression: Compression) -> CompressionBuilder<Self, Zlib> { ... } }
Expand description

The trait that can construct readers and writers, but also has chainable functions to create more complex builders

Required Associated Types§

Source

type Reader

The reader type that will be constructed by the reader function

Source

type Writer

The writer type that will be constructed by the reader function

Required Methods§

Source

fn reader(&self) -> Result<Self::Reader>

Construct a reader from this builder

§Errors

In case the construction of any of the intermediate readers fails this will return the error associated to the first one that failed.

Source

fn writer(&self) -> Result<Self::Writer>

Construct a writer from this builder

§Errors

In case the construction of any of the intermediate writers fails this will return the error associated to the first one that failed.

Provided Methods§

Source

fn buffered(self) -> BufferedBuilder<Self>

Buffers the underlying readers and writers by wrapping them in a BufReader or BufWriter

Source

fn string(self) -> Builder<Self>

Sink that provides a bridge between String instances and underlying readers and writers.

Source

fn bincode(self) -> BincodeBuilder<Self>

Sink that provides a bridge between serde and the underlying readers and writer by transforming from and to bincode.

Source

fn chacha20( self, key: ChaCha20Key, nonce: ChaCha20Nonce, ) -> ChaCha20Builder<Self>

Transformation that decrypts while reading and encrypts while writing using the chacha20 cipher

Source

fn salsa20(self, key: Salsa20Key, nonce: Salsa20Nonce) -> Salsa20Builder<Self>

Transformation that decrypts while reading and encrypts while writing using the salsa20 cipher

Source

fn crc(self) -> CrcBuilder<Self>

Non-commutative transformation that hashes using the CRC algorithm

Source

fn deflate(self, compression: Compression) -> CompressionBuilder<Self, Deflate>

Transformation that decompresses while reading and compresses while writing using the Deflate algorithm

Source

fn gz(self, compression: Compression) -> CompressionBuilder<Self, Gz>

Transformation that decompresses while reading and compresses while writing using the Gz algorithm

Source

fn zlib(self, compression: Compression) -> CompressionBuilder<Self, Zlib>

Transformation that decompresses while reading and compresses while writing using the Zlib algorithm

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl RwBuilder for rw_builder::FileBuilder

Source§

impl RwBuilder for rw_builder::ProcessBuilder

Source§

impl RwBuilder for rw_builder::VecBuilder

Source§

type Reader = Reader

Source§

type Writer = Writer

Source§

impl<A> RwBuilder for rw_builder::TcpStreamBuilder<A>
where A: ToSocketAddrs,

Source§

impl<B> RwBuilder for rw_builder::BufferedBuilder<B>
where B: RwBuilder, B::Reader: Read, B::Writer: Write,

Source§

impl<B> RwBuilder for CrcBuilder<B>
where B: RwBuilder, B::Reader: Read, B::Writer: Write,

Source§

impl<B, C> RwBuilder for CompressionBuilder<B, C>
where B: RwBuilder, B::Reader: Read, B::Writer: Write, C: CoderBuilder<B::Reader, B::Writer>, C::Decoder: Read, C::Encoder: Write,

Source§

type Reader = <C as CoderBuilder<<B as RwBuilder>::Reader, <B as RwBuilder>::Writer>>::Decoder

Source§

type Writer = <C as CoderBuilder<<B as RwBuilder>::Reader, <B as RwBuilder>::Writer>>::Encoder