pub trait Parse<'a, T> {
// Required method
fn from_reader<R: 'a + Read + Send + Sync>(reader: R) -> Result<T>;
// Provided methods
fn from_buffered_reader<R>(reader: R) -> Result<T>
where R: BufferedReader<Cookie> + 'a { ... }
fn from_file<P: AsRef<Path>>(path: P) -> Result<T> { ... }
fn from_bytes<D: AsRef<[u8]> + ?Sized + Send + Sync>(
data: &'a D,
) -> Result<T> { ... }
}
Expand description
Parsing of packets and related structures.
This is a uniform interface to parse packets, messages, keys, and related data structures.
Required Methods§
Provided Methods§
Sourcefn from_buffered_reader<R>(reader: R) -> Result<T>where
R: BufferedReader<Cookie> + 'a,
fn from_buffered_reader<R>(reader: R) -> Result<T>where
R: BufferedReader<Cookie> + 'a,
Reads from the given buffered reader.
Sourcefn from_file<P: AsRef<Path>>(path: P) -> Result<T>
fn from_file<P: AsRef<Path>>(path: P) -> Result<T>
Reads from the given file.
The default implementation just uses from_reader(..)
, but
implementations can provide their own specialized version.
Sourcefn from_bytes<D: AsRef<[u8]> + ?Sized + Send + Sync>(data: &'a D) -> Result<T>
fn from_bytes<D: AsRef<[u8]> + ?Sized + Send + Sync>(data: &'a D) -> Result<T>
Reads from the given slice.
The default implementation just uses from_reader(..)
, but
implementations can provide their own specialized version.
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.