Struct Native

Source
pub struct Native<T>(pub T);
Expand description

Wrapper IO type for Read and Write.

Tuple Fields§

§0: T

Trait Implementations§

Source§

impl<T> Container for Native<T>

Source§

type Inner = T

The inner type this container stores.
Source§

fn from_inner(inner: Self::Inner) -> Self

Construct a Self from the inner type.
Source§

fn get_ref(&self) -> &Self::Inner

Get a reference to the inner type.
Source§

fn get_mut(&mut self) -> &mut Self::Inner

Get a mutable reference to the inner type.
Source§

fn into_inner(self) -> Self::Inner

Destruct the container into its inner type.
Source§

impl<T: Debug> Debug for Native<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Read for Native<T>
where T: Read,

Source§

type Error = <T as Read>::Error

Error type for IO operations involving the reader.
Source§

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

Read some bytes into the slice buf. Read more
Source§

impl<T> Write for Native<T>
where T: Write,

Source§

type Error = <T as Write>::Error

Error type for IO operations involving the writer.
Source§

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

Write some bytes from buf to the writer. Read more
Source§

fn flush_once(&mut self) -> Result<(), Self::Error>

Flush this writer once ensuring all bytes reach their destination. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for Native<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<T> IntoRead<Native<T>> for T
where T: Read,

Source§

fn into_read(self) -> Native<T>

Convert self to a reader T.
Source§

impl<T> IntoWrite<Native<T>> for T
where T: Write,

Source§

fn into_write(self) -> Native<T>

Convert self to a writer T.
Source§

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

Source§

fn read_buf<B>(&mut self, buf: B) -> Result<(), Self::Error>
where B: BufMut,

Read some bytes into buf advancing it appropriately.
Source§

fn read_buf_all<B>(&mut self, buf: B) -> Result<(), Self::Error>
where B: BufMut,

Read bytes into buf advancing it until it is full. Read more
Source§

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

Create a “by reference” adapter that takes the current instance of Read by mutable reference.
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.
Source§

impl<T> WriteExt for T
where T: Write + ?Sized,

Source§

fn write_buf<B>(&mut self, buf: B) -> Result<(), Self::Error>
where B: Buf,

Write buf to the writer advancing it appropriately.
Source§

fn write_buf_all<B>(&mut self, buf: B) -> Result<(), Self::Error>
where B: Buf,

Write buf to the writer advancing it until all of it has been written. Read more
Source§

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

Flush this writer ensuring all bytes reach their destination.
Source§

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

Create a “by reference” adapter that takes the current instance of Write by mutable reference.
Source§

fn transaction( self, kind: WriteTransactionKind<'_>, ) -> WriteTransactionVariant<'_, Self>
where Self: Sized,

Available on crate feature alloc only.
Create a transaction that uses this writer. Read more