[][src]Trait ffsend_api::pipe::Pipe

pub trait Pipe: Sized {
    type Reader: PipeRead<Self>;
    type Writer: PipeWrite<Self>;
    fn pipe(&mut self, input: &[u8]) -> (usize, Option<Vec<u8>>);

    fn reader(self, inner: Box<dyn Read>) -> Self::Reader { ... }
fn writer(self, inner: Box<dyn Write>) -> Self::Writer { ... }
fn pipe_transparent(&self, input: &[u8]) -> (usize, Option<Vec<u8>>) { ... } }

Something that can pipe given data.

A pipe may monitor, but also transform data flowing through it.

From this pipe, a reader or writer can be created using the corresponding reader and writer functions to wrap an existing reader or writer.

Associated Types

type Reader: PipeRead<Self>

The wrapping reader type used for this pipe.

type Writer: PipeWrite<Self>

The wrapping writer type used for this pipe.

Loading content...

Required methods

fn pipe(&mut self, input: &[u8]) -> (usize, Option<Vec<u8>>)

Pipe bytes from input, monitor/transform it, return the output.

This should not be used directly, and is automatically used by a PipeRead or PipeWrite object for the actual piping.

This returns a tuple with the number of bytes read from the input, along with transformed data if available in the following format: (read_bytes, transformed_data).

Pipes that just monitor data, immediately return the input. The pipe_transparent helper function can be used for this inside the implementation.

Loading content...

Provided methods

fn reader(self, inner: Box<dyn Read>) -> Self::Reader

Wrap the inner reader, bytes that are read are transformed through this pipe.

fn writer(self, inner: Box<dyn Write>) -> Self::Writer

Wrap the inner writer, bytes that are read are transformed through this pipe.

fn pipe_transparent(&self, input: &[u8]) -> (usize, Option<Vec<u8>>)

Transparently pipe input by immediately returning it.

This should not be used directly, and is automatically used by a PipeRead or PipeWrite object for the actual piping.

This can be used as helper function inside the pipe function if data is only monitored and not transformed.

Loading content...

Implementors

impl Pipe for EceCrypt[src]

type Reader = EceReader

type Writer = EceWriter

impl Pipe for GcmCrypt[src]

type Reader = GcmReader

type Writer = GcmWriter

impl Pipe for ProgressPipe[src]

type Reader = ProgressReader

type Writer = ProgressWriter

Loading content...