[][src]Struct loco_protocol::command::processor::CommandProcessor

pub struct CommandProcessor<S: Read + Write> { /* fields omitted */ }

Like BufReader and BufWriter, provide optimized Command read/write operation to stream.

Implementations

impl<S: Read + Write> CommandProcessor<S>[src]

pub fn new(stream: S) -> Self[src]

pub fn stream(&self) -> &S[src]

pub fn stream_mut(&mut self) -> &mut S[src]

pub fn current_header(&self) -> Option<Header>[src]

pub fn into_inner(self) -> S[src]

Consume this CommandProcessor and unwrap stream

pub fn read_commmand(&mut self) -> Result<Option<Command>, Error>[src]

Try to read one command.

It will try to read internal buffer first to make sure if there is unread command. Stream read will be only tried when there are not enough data in internal buffer.

pub fn read_all_command(&mut self) -> Result<Vec<Command>, Error>[src]

Read all command

pub fn write_commmand(&mut self, command: Command) -> Result<usize, Error>[src]

Write command to stream.

pub fn write_all_command(&mut self, list: Vec<Command>) -> Result<usize, Error>[src]

Auto Trait Implementations

impl<S> RefUnwindSafe for CommandProcessor<S> where
    S: RefUnwindSafe

impl<S> Send for CommandProcessor<S> where
    S: Send

impl<S> Sync for CommandProcessor<S> where
    S: Sync

impl<S> Unpin for CommandProcessor<S> where
    S: Unpin

impl<S> UnwindSafe for CommandProcessor<S> where
    S: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.