[][src]Struct libojo::UnidentifiedPatch

pub struct UnidentifiedPatch { /* fields omitted */ }

Like a Patch, but without the unique id.

A patch is ultimately identified by its id, which is generated by hashing the contents of the serialized patch. This ends up being a bit circular, because the contents of the patch might actually depend on the id, and those contents in turn will affect the id. The way we break this cycle is by separating "unidentified" patches (those without an id yet) from completed patches with an id.

This is an unidentified patch; it does not have an id field, and any changes that need to refer to contents of this patch use the placeholder id returned by PatchId::cur.

This patch cannot be applied to a repository, because doing so would require an id. However, it can be serialized to a file, and it can be turned into an identified patch.

Methods

impl UnidentifiedPatch[src]

pub fn new(
    author: String,
    description: String,
    changes: Changes
) -> UnidentifiedPatch
[src]

Creates a new UnidentifiedPatch from some metadata and a set of changes.

pub fn write_out<W: Write>(self, writer: W) -> Result<Patch, Error>[src]

Writes out a patch.

While writing out the patch, we compute the hash of its contents and use that to derive an id for this patch. Assuming that the writing succeeds, we return the resulting Patch.

Trait Implementations

impl PartialEq<UnidentifiedPatch> for UnidentifiedPatch[src]

impl Clone for UnidentifiedPatch[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Eq for UnidentifiedPatch[src]

impl Hash for UnidentifiedPatch[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Debug for UnidentifiedPatch[src]

impl<'de> Deserialize<'de> for UnidentifiedPatch[src]

impl Serialize for UnidentifiedPatch[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Same for T

type Output = T

Should always be Self