Skip to main content

PlanBuilder

Struct PlanBuilder 

Source
pub struct PlanBuilder { /* private fields */ }
Expand description

Accumulates files and their edits into one envelope.

Implementations§

Source§

impl PlanBuilder

Source

pub fn new(operation: impl Into<String>) -> Self

Starts a plan for one operation.

Source

pub fn file(self, path: &str, sha256: &str) -> Self

Opens or reuses a file entry. Edits added after this land on it.

Reusing keeps one entry per path: two entries for the same file would each carry the same “before” hash and the second would be applied to bytes the first already changed.

Source

pub fn edit( self, start_line: u32, start_char: u32, end_line: u32, end_char: u32, before: impl Into<String>, after: impl Into<String>, provenance: &str, ) -> Self

Adds one byte-exact edit to the file opened last.

Source

pub fn is_empty(&self) -> bool

Whether anything would actually be written.

Source

pub fn build(self) -> Value

Finishes the envelope.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.