tokio_core::reactor

Struct PollEvented

Source
pub struct PollEvented<E> { /* private fields */ }
Expand description

A concrete implementation of a stream of readiness notifications for I/O objects that originates from an event loop.

Created by the PollEvented::new method, each PollEvented is associated with a specific event loop and source of events that will be registered with an event loop.

An instance of PollEvented is essentially the bridge between the mio world and the tokio-core world, providing abstractions to receive notifications about changes to an object’s mio::Ready state.

Each readiness stream has a number of methods to test whether the underlying object is readable or writable. Once the methods return that an object is readable/writable, then it will continue to do so until the need_read or need_write methods are called.

That is, this object is typically wrapped in another form of I/O object. It’s the responsibility of the wrapper to inform the readiness stream when a “would block” I/O event is seen. The readiness stream will then take care of any scheduling necessary to get notified when the event is ready again.

You can find more information about creating a custom I/O object online.

§Readiness to read/write

A PollEvented allows listening and waiting for an arbitrary mio::Ready instance, including the platform-specific contents of mio::Ready. At most two future tasks, however, can be waiting on a PollEvented. The need_read and need_write methods can block two separate tasks, one on reading and one on writing. Not all I/O events correspond to read/write, however!

To account for this a PollEvented gets a little interesting when working with an arbitrary instance of mio::Ready that may not map precisely to “write” and “read” tasks. Currently it is defined that instances of mio::Ready that do not return true from is_writable are all notified through need_read, or the read task.

In other words, poll_ready with the mio::UnixReady::hup event will block the read task of this PollEvented if the hup event isn’t available. Essentially a good rule of thumb is that if you’re using the poll_ready method you want to also use need_read to signal blocking and you should otherwise probably avoid using two tasks on the same PollEvented.

Implementations§

Source§

impl<E: Evented> PollEvented<E>

Source

pub fn new(io: E, handle: &Handle) -> Result<PollEvented<E>>

Creates a new readiness stream associated with the provided loop_handle and for the given source.

This method returns a future which will resolve to the readiness stream when it’s ready.

Source

pub fn deregister(self, _: &Handle) -> Result<()>

Deregisters this source of events from the reactor core specified.

This method can optionally be called to unregister the underlying I/O object with the event loop that the handle provided points to. Typically this method is not required as this automatically happens when E is dropped, but for some use cases the E object doesn’t represent an owned reference, so dropping it won’t automatically unregister with the event loop.

This consumes self as it will no longer provide events after the method is called, and will likely return an error if this PollEvented was created on a separate event loop from the handle specified.

Source§

impl<E> PollEvented<E>

Source

pub fn poll_read(&self) -> Async<()>

Tests to see if this source is ready to be read from or not.

If this stream is not ready for a read then NotReady will be returned and the current task will be scheduled to receive a notification when the stream is readable again. In other words, this method is only safe to call from within the context of a future’s task, typically done in a Future::poll method.

This is mostly equivalent to self.poll_ready(Ready::readable()).

§Panics

This function will panic if called outside the context of a future’s task.

Source

pub fn poll_write(&self) -> Async<()>

Tests to see if this source is ready to be written to or not.

If this stream is not ready for a write then NotReady will be returned and the current task will be scheduled to receive a notification when the stream is writable again. In other words, this method is only safe to call from within the context of a future’s task, typically done in a Future::poll method.

This is mostly equivalent to self.poll_ready(Ready::writable()).

§Panics

This function will panic if called outside the context of a future’s task.

Source

pub fn poll_ready(&self, mask: Ready) -> Async<Ready>

Test to see whether this source fulfills any condition listed in mask provided.

The mask given here is a mio Ready set of possible events. This can contain any events like read/write but also platform-specific events such as hup and error. The mask indicates events that are interested in being ready.

If any event in mask is ready then it is returned through Async::Ready. The Ready set returned is guaranteed to not be empty and contains all events that are currently ready in the mask provided.

If no events are ready in the mask provided then the current task is scheduled to receive a notification when any of them become ready. If the writable event is contained within mask then this PollEvented’s write task will be blocked and otherwise the read task will be blocked. This is generally only relevant if you’re working with this PollEvented object on multiple tasks.

§Panics

This function will panic if called outside the context of a future’s task.

Source

pub fn need_read(&self)

Indicates to this source of events that the corresponding I/O object is no longer readable, but it needs to be.

This function, like poll_read, is only safe to call from the context of a future’s task (typically in a Future::poll implementation). It informs this readiness stream that the underlying object is no longer readable, typically because a “would block” error was seen.

All readiness bits associated with this stream except the writable bit will be reset when this method is called. The current task is then scheduled to receive a notification whenever anything changes other than the writable bit. Note that this typically just means the readable bit is used here, but if you’re using a custom I/O object for events like hup/error this may also be relevant.

Note that it is also only valid to call this method if poll_read previously indicated that the object is readable. That is, this function must always be paired with calls to poll_read previously.

§Panics

This function will panic if called outside the context of a future’s task.

Source

pub fn need_write(&self)

Indicates to this source of events that the corresponding I/O object is no longer writable, but it needs to be.

This function, like poll_write, is only safe to call from the context of a future’s task (typically in a Future::poll implementation). It informs this readiness stream that the underlying object is no longer writable, typically because a “would block” error was seen.

The flag indicating that this stream is writable is unset and the current task is scheduled to receive a notification when the stream is then again writable.

Note that it is also only valid to call this method if poll_write previously indicated that the object is writable. That is, this function must always be paired with calls to poll_write previously.

§Panics

This function will panic if called outside the context of a future’s task.

Source

pub fn remote(&self) -> &Remote

Returns a reference to the event loop handle that this readiness stream is associated with.

Source

pub fn get_ref(&self) -> &E

Returns a shared reference to the underlying I/O object this readiness stream is wrapping.

Source

pub fn get_mut(&mut self) -> &mut E

Returns a mutable reference to the underlying I/O object this readiness stream is wrapping.

Trait Implementations§

Source§

impl<'a, E> AsyncRead for &'a PollEvented<E>
where &'a E: Read,

Source§

unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [u8]) -> bool

Prepares an uninitialized buffer to be safe to pass to read. Returns true if the supplied buffer was zeroed out. Read more
Source§

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

Attempt to read from the AsyncRead into buf. Read more
Source§

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

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

fn framed<T>(self, codec: T) -> Framed<Self, T>
where T: Encoder + Decoder, Self: Sized + AsyncWrite,

👎Deprecated since 0.1.7: Use tokio_codec::Decoder::framed instead
Provides a Stream and Sink interface for reading and writing to this I/O object, using Decode and Encode to read and write the raw data. Read more
Source§

fn split(self) -> (ReadHalf<Self>, WriteHalf<Self>)
where Self: Sized + AsyncWrite,

Helper method for splitting this read/write object into two halves. Read more
Source§

impl<E: Read> AsyncRead for PollEvented<E>

Source§

unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [u8]) -> bool

Prepares an uninitialized buffer to be safe to pass to read. Returns true if the supplied buffer was zeroed out. Read more
Source§

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

Attempt to read from the AsyncRead into buf. Read more
Source§

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

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

fn framed<T>(self, codec: T) -> Framed<Self, T>
where T: Encoder + Decoder, Self: Sized + AsyncWrite,

👎Deprecated since 0.1.7: Use tokio_codec::Decoder::framed instead
Provides a Stream and Sink interface for reading and writing to this I/O object, using Decode and Encode to read and write the raw data. Read more
Source§

fn split(self) -> (ReadHalf<Self>, WriteHalf<Self>)
where Self: Sized + AsyncWrite,

Helper method for splitting this read/write object into two halves. Read more
Source§

impl<'a, E> AsyncWrite for &'a PollEvented<E>
where &'a E: Write,

Source§

fn shutdown(&mut self) -> Poll<(), Error>

Initiates or attempts to shut down this writer, returning success when the I/O connection has completely shut down. Read more
Source§

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

Attempt to write bytes from buf into the object. Read more
Source§

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

Attempt to flush the object, ensuring that any buffered data reach their destination. Read more
Source§

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

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

impl<E: Write> AsyncWrite for PollEvented<E>

Source§

fn shutdown(&mut self) -> Poll<(), Error>

Initiates or attempts to shut down this writer, returning success when the I/O connection has completely shut down. Read more
Source§

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

Attempt to write bytes from buf into the object. Read more
Source§

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

Attempt to flush the object, ensuring that any buffered data reach their destination. Read more
Source§

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

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

impl<E: Evented + Debug> Debug for PollEvented<E>

Source§

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

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

impl<'a, E> Read for &'a PollEvented<E>
where &'a E: Read,

Source§

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

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

fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>

Like read, except that it reads into a slice of buffers. Read more
Source§

fn is_read_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Reader has an efficient read_vectored implementation. Read more
1.0.0 · Source§

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

Reads all bytes until EOF in this source, placing them into buf. Read more
1.0.0 · Source§

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

Reads all bytes until EOF in this source, appending them to buf. Read more
1.6.0 · Source§

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

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

fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Pull some bytes from this source into the specified buffer. Read more
Source§

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Reads the exact number of bytes required to fill cursor. Read more
1.0.0 · Source§

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

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

fn bytes(self) -> Bytes<Self>
where Self: Sized,

Transforms this Read instance to an Iterator over its bytes. Read more
1.0.0 · Source§

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

Creates an adapter which will chain this stream with another. Read more
1.0.0 · Source§

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more
Source§

impl<E: Read> Read for PollEvented<E>

Source§

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

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

fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>

Like read, except that it reads into a slice of buffers. Read more
Source§

fn is_read_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Reader has an efficient read_vectored implementation. Read more
1.0.0 · Source§

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

Reads all bytes until EOF in this source, placing them into buf. Read more
1.0.0 · Source§

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

Reads all bytes until EOF in this source, appending them to buf. Read more
1.6.0 · Source§

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

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

fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Pull some bytes from this source into the specified buffer. Read more
Source§

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Reads the exact number of bytes required to fill cursor. Read more
1.0.0 · Source§

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

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

fn bytes(self) -> Bytes<Self>
where Self: Sized,

Transforms this Read instance to an Iterator over its bytes. Read more
1.0.0 · Source§

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

Creates an adapter which will chain this stream with another. Read more
1.0.0 · Source§

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more
Source§

impl<'a, E> Write for &'a PollEvented<E>
where &'a E: Write,

Source§

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

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

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

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

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>

Like write, except that it writes from a slice of buffers. Read more
Source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored implementation. Read more
1.0.0 · Source§

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

Attempts to write an entire buffer into this writer. Read more
Source§

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
1.0.0 · Source§

fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>

Writes a formatted string into this writer, returning any error encountered. Read more
1.0.0 · Source§

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

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

impl<E: Write> Write for PollEvented<E>

Source§

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

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

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

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

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>

Like write, except that it writes from a slice of buffers. Read more
Source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored implementation. Read more
1.0.0 · Source§

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

Attempts to write an entire buffer into this writer. Read more
Source§

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
1.0.0 · Source§

fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>

Writes a formatted string into this writer, returning any error encountered. Read more
1.0.0 · Source§

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

Creates a “by reference” adapter for this instance of Write. Read more

Auto Trait Implementations§

§

impl<E> !Freeze for PollEvented<E>

§

impl<E> !RefUnwindSafe for PollEvented<E>

§

impl<E> Send for PollEvented<E>
where E: Send,

§

impl<E> Sync for PollEvented<E>
where E: Sync,

§

impl<E> Unpin for PollEvented<E>
where E: Unpin,

§

impl<E> !UnwindSafe for PollEvented<E>

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> ReadBytesExt for R
where R: Read + ?Sized,

Source§

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

Reads an unsigned 8 bit integer from the underlying reader. Read more
Source§

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

Reads a signed 8 bit integer from the underlying reader. Read more
Source§

fn read_u16<T>(&mut self) -> Result<u16, Error>
where T: ByteOrder,

Reads an unsigned 16 bit integer from the underlying reader. Read more
Source§

fn read_i16<T>(&mut self) -> Result<i16, Error>
where T: ByteOrder,

Reads a signed 16 bit integer from the underlying reader. Read more
Source§

fn read_u24<T>(&mut self) -> Result<u32, Error>
where T: ByteOrder,

Reads an unsigned 24 bit integer from the underlying reader. Read more
Source§

fn read_i24<T>(&mut self) -> Result<i32, Error>
where T: ByteOrder,

Reads a signed 24 bit integer from the underlying reader. Read more
Source§

fn read_u32<T>(&mut self) -> Result<u32, Error>
where T: ByteOrder,

Reads an unsigned 32 bit integer from the underlying reader. Read more
Source§

fn read_i32<T>(&mut self) -> Result<i32, Error>
where T: ByteOrder,

Reads a signed 32 bit integer from the underlying reader. Read more
Source§

fn read_u48<T>(&mut self) -> Result<u64, Error>
where T: ByteOrder,

Reads an unsigned 48 bit integer from the underlying reader. Read more
Source§

fn read_i48<T>(&mut self) -> Result<i64, Error>
where T: ByteOrder,

Reads a signed 48 bit integer from the underlying reader. Read more
Source§

fn read_u64<T>(&mut self) -> Result<u64, Error>
where T: ByteOrder,

Reads an unsigned 64 bit integer from the underlying reader. Read more
Source§

fn read_i64<T>(&mut self) -> Result<i64, Error>
where T: ByteOrder,

Reads a signed 64 bit integer from the underlying reader. Read more
Source§

fn read_u128<T>(&mut self) -> Result<u128, Error>
where T: ByteOrder,

Reads an unsigned 128 bit integer from the underlying reader. Read more
Source§

fn read_i128<T>(&mut self) -> Result<i128, Error>
where T: ByteOrder,

Reads a signed 128 bit integer from the underlying reader. Read more
Source§

fn read_uint<T>(&mut self, nbytes: usize) -> Result<u64, Error>
where T: ByteOrder,

Reads an unsigned n-bytes integer from the underlying reader. Read more
Source§

fn read_int<T>(&mut self, nbytes: usize) -> Result<i64, Error>
where T: ByteOrder,

Reads a signed n-bytes integer from the underlying reader. Read more
Source§

fn read_uint128<T>(&mut self, nbytes: usize) -> Result<u128, Error>
where T: ByteOrder,

Reads an unsigned n-bytes integer from the underlying reader.
Source§

fn read_int128<T>(&mut self, nbytes: usize) -> Result<i128, Error>
where T: ByteOrder,

Reads a signed n-bytes integer from the underlying reader.
Source§

fn read_f32<T>(&mut self) -> Result<f32, Error>
where T: ByteOrder,

Reads a IEEE754 single-precision (4 bytes) floating point number from the underlying reader. Read more
Source§

fn read_f64<T>(&mut self) -> Result<f64, Error>
where T: ByteOrder,

Reads a IEEE754 double-precision (8 bytes) floating point number from the underlying reader. Read more
Source§

fn read_u16_into<T>(&mut self, dst: &mut [u16]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of unsigned 16 bit integers from the underlying reader. Read more
Source§

fn read_u32_into<T>(&mut self, dst: &mut [u32]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of unsigned 32 bit integers from the underlying reader. Read more
Source§

fn read_u64_into<T>(&mut self, dst: &mut [u64]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of unsigned 64 bit integers from the underlying reader. Read more
Source§

fn read_u128_into<T>(&mut self, dst: &mut [u128]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of unsigned 128 bit integers from the underlying reader. Read more
Source§

fn read_i8_into(&mut self, dst: &mut [i8]) -> Result<(), Error>

Reads a sequence of signed 8 bit integers from the underlying reader. Read more
Source§

fn read_i16_into<T>(&mut self, dst: &mut [i16]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of signed 16 bit integers from the underlying reader. Read more
Source§

fn read_i32_into<T>(&mut self, dst: &mut [i32]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of signed 32 bit integers from the underlying reader. Read more
Source§

fn read_i64_into<T>(&mut self, dst: &mut [i64]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of signed 64 bit integers from the underlying reader. Read more
Source§

fn read_i128_into<T>(&mut self, dst: &mut [i128]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of signed 128 bit integers from the underlying reader. Read more
Source§

fn read_f32_into<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of IEEE754 single-precision (4 bytes) floating point numbers from the underlying reader. Read more
Source§

fn read_f32_into_unchecked<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>
where T: ByteOrder,

👎Deprecated since 1.2.0: please use read_f32_into instead
DEPRECATED. Read more
Source§

fn read_f64_into<T>(&mut self, dst: &mut [f64]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of IEEE754 double-precision (8 bytes) floating point numbers from the underlying reader. Read more
Source§

fn read_f64_into_unchecked<T>(&mut self, dst: &mut [f64]) -> Result<(), Error>
where T: ByteOrder,

👎Deprecated since 1.2.0: please use read_f64_into instead
DEPRECATED. Read more
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<W> WriteBytesExt for W
where W: Write + ?Sized,

Source§

fn write_u8(&mut self, n: u8) -> Result<(), Error>

Writes an unsigned 8 bit integer to the underlying writer. Read more
Source§

fn write_i8(&mut self, n: i8) -> Result<(), Error>

Writes a signed 8 bit integer to the underlying writer. Read more
Source§

fn write_u16<T>(&mut self, n: u16) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned 16 bit integer to the underlying writer. Read more
Source§

fn write_i16<T>(&mut self, n: i16) -> Result<(), Error>
where T: ByteOrder,

Writes a signed 16 bit integer to the underlying writer. Read more
Source§

fn write_u24<T>(&mut self, n: u32) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned 24 bit integer to the underlying writer. Read more
Source§

fn write_i24<T>(&mut self, n: i32) -> Result<(), Error>
where T: ByteOrder,

Writes a signed 24 bit integer to the underlying writer. Read more
Source§

fn write_u32<T>(&mut self, n: u32) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned 32 bit integer to the underlying writer. Read more
Source§

fn write_i32<T>(&mut self, n: i32) -> Result<(), Error>
where T: ByteOrder,

Writes a signed 32 bit integer to the underlying writer. Read more
Source§

fn write_u48<T>(&mut self, n: u64) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned 48 bit integer to the underlying writer. Read more
Source§

fn write_i48<T>(&mut self, n: i64) -> Result<(), Error>
where T: ByteOrder,

Writes a signed 48 bit integer to the underlying writer. Read more
Source§

fn write_u64<T>(&mut self, n: u64) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned 64 bit integer to the underlying writer. Read more
Source§

fn write_i64<T>(&mut self, n: i64) -> Result<(), Error>
where T: ByteOrder,

Writes a signed 64 bit integer to the underlying writer. Read more
Source§

fn write_u128<T>(&mut self, n: u128) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned 128 bit integer to the underlying writer.
Source§

fn write_i128<T>(&mut self, n: i128) -> Result<(), Error>
where T: ByteOrder,

Writes a signed 128 bit integer to the underlying writer.
Source§

fn write_uint<T>(&mut self, n: u64, nbytes: usize) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned n-bytes integer to the underlying writer. Read more
Source§

fn write_int<T>(&mut self, n: i64, nbytes: usize) -> Result<(), Error>
where T: ByteOrder,

Writes a signed n-bytes integer to the underlying writer. Read more
Source§

fn write_uint128<T>(&mut self, n: u128, nbytes: usize) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned n-bytes integer to the underlying writer. Read more
Source§

fn write_int128<T>(&mut self, n: i128, nbytes: usize) -> Result<(), Error>
where T: ByteOrder,

Writes a signed n-bytes integer to the underlying writer. Read more
Source§

fn write_f32<T>(&mut self, n: f32) -> Result<(), Error>
where T: ByteOrder,

Writes a IEEE754 single-precision (4 bytes) floating point number to the underlying writer. Read more
Source§

fn write_f64<T>(&mut self, n: f64) -> Result<(), Error>
where T: ByteOrder,

Writes a IEEE754 double-precision (8 bytes) floating point number to the underlying writer. Read more