[−][src]Struct loco_protocol::command::processor::CommandProcessor
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,
S: RefUnwindSafe,
impl<S> Send for CommandProcessor<S> where
S: Send,
S: Send,
impl<S> Sync for CommandProcessor<S> where
S: Sync,
S: Sync,
impl<S> Unpin for CommandProcessor<S> where
S: Unpin,
S: Unpin,
impl<S> UnwindSafe for CommandProcessor<S> where
S: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,