Skip to main content

GenioIo

Struct GenioIo 

Source
pub struct GenioIo<T>(/* private fields */);
Expand description

Wrapper providing genio::Read + genio::Write traits for std::io::Read + std::io::Write types.

Implementations§

Source§

impl<T: Read + Write> GenioIo<T>

Source

pub fn new(io: T) -> Self

Wraps std reader+writer into genio reader+writer.

Source

pub fn into_inner(self) -> T

Unwraps std reader+writer into genio reader+writer.

Trait Implementations§

Source§

impl<T: Read> Read for GenioIo<T>

Source§

type ReadError = Error

Value of this type is returned when read() fails. Read more
Source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§

fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::ReadError>>

Read the exact number of bytes required to fill buf. Read more
Source§

fn available_bytes(&self, _at_least: usize) -> bool

Hints whether there are at least at_least bytes available. Read more
Source§

fn chain<R: Read>(self, other: R) -> Chain<Self, R>
where Self: Sized,

Chains another reader after self. When self ends (returns Ok(0)), the other reader will provide bytes to read.
Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adaptor for this instance of Read. Read more
Source§

impl<T: Write> Write for GenioIo<T>

Source§

type WriteError = Error

Value of this type is returned when write() fails. Read more
Source§

type FlushError = Error

Value of this type is returned when flush() fails. In case of low-level writers flush often does nothing and therefore doesn’t return error, so this type might be Void. Read more
Source§

fn write(&mut self, buf: &[u8]) -> Result<usize, Error>

Write a buffer into this object, returning how many bytes were written. Read more
Source§

fn flush(&mut self) -> Result<(), Error>

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
Source§

fn size_hint(&mut self, _bytes: usize)

Hints the writer how much bytes will be written after call to this function. If the maximum amount of bytes to be written is known then it should be passed as argument. If the maximum amount is unknown, then minimum should be passed. Read more
Source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::WriteError>

Attempts to write an entire buffer into this Write.
Source§

fn uses_size_hint(&self) -> bool

Reports to the caller whether size hint is actually used. This can prevent costly computation of size hint that would be thrown away.

Auto Trait Implementations§

§

impl<T> Freeze for GenioIo<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for GenioIo<T>
where T: RefUnwindSafe,

§

impl<T> Send for GenioIo<T>
where T: Send,

§

impl<T> Sync for GenioIo<T>
where T: Sync,

§

impl<T> Unpin for GenioIo<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for GenioIo<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for GenioIo<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<R> ReadExt for R
where R: Read + ?Sized,

Source§

fn read_ext<'a, 'b>( &'a mut self, buf: &'b mut [u8], ) -> Result<ReadResult<'b>, <R as Read>::ReadError>

Reads from the reader and converts the result.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.