Trait Decode

Source
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§

Source

fn decode(r: &mut impl BufRead) -> Result<Self, Error>

Decode, and fail if we reach the end of the stream.

Provided Methods§

Source

fn try_decode(r: &mut impl BufRead) -> Result<Option<Self>, Error>

Decode, and return a None if we reached the end of the stream.

Source

fn parse(s: &str) -> Result<Self, Error>

Decode from a string input.

Source

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.

Implementations on Foreign Types§

Source§

impl Decode for DiffContent

Source§

fn decode(r: &mut impl BufRead) -> Result<Self, Error>

Source§

impl Decode for Modification

Source§

fn decode(r: &mut impl BufRead) -> Result<Self, Error>

Source§

impl Decode for Diff

Source§

fn decode(r: &mut impl BufRead) -> Result<Self, Error>

Decode from git’s unified diff format, consuming the entire input.

Source§

impl Decode for Hunk<DiffModification>

Source§

fn decode(r: &mut impl BufRead) -> Result<Self, Error>

Source§

impl Decode for Hunk<Modification>

Source§

fn decode(r: &mut impl BufRead) -> Result<Self, Error>

Implementors§