pub trait PodReadExt {
// Required methods
fn read_pod<P: Pod>(&mut self) -> Result<P>;
fn read_pod_or_none<P: Pod>(&mut self) -> Result<Option<P>>;
}
Expand description
An extension trait for reading Pod
types from std::io::Read
data streams.
Required Methods§
Sourcefn read_pod<P: Pod>(&mut self) -> Result<P>
fn read_pod<P: Pod>(&mut self) -> Result<P>
Reads a Pod
struct from the stream. Behaves like read_exact
, and will
produce an error if EOF is encountered before the data is fully read.
Sourcefn read_pod_or_none<P: Pod>(&mut self) -> Result<Option<P>>
fn read_pod_or_none<P: Pod>(&mut self) -> Result<Option<P>>
Reads a Pod
struct from the stream, or nothing at EOF. Partial reads
will result in an error.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.