pub trait Decode: Sized {
// Required method
fn decode(r: &mut impl BufRead) -> Result<Self, Error>;
// Provided methods
fn try_decode(r: &mut impl BufRead) -> Result<Option<Self>, Error> { ... }
fn parse(s: &str) -> Result<Self, Error> { ... }
fn from_bytes(bytes: &[u8]) -> Result<Self, Error> { ... }
}
Expand description
Diff-related types that can be decoded from the unified diff format.
Required Methods§
Provided Methods§
Sourcefn try_decode(r: &mut impl BufRead) -> Result<Option<Self>, Error>
fn try_decode(r: &mut impl BufRead) -> Result<Option<Self>, Error>
Decode, and return a None
if we reached the end of the stream.
Sourcefn from_bytes(bytes: &[u8]) -> Result<Self, Error>
fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
Decode from a string input.
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.