Skip to main content

ByteEditBatch

Struct ByteEditBatch 

Source
pub struct ByteEditBatch<'source> { /* private fields */ }
Expand description

Transactional builder for a bounded batch over one immutable source revision.

Every range and before value always refers to source, including edits submitted by later calls. This is intentionally not a current-document edit session: accepted edits do not shift coordinates for subsequent admission.

Implementations§

Source§

impl<'source> ByteEditBatch<'source>

Source

pub fn new(source: &'source str) -> Result<Self, EditError>

Starts an empty batch with default hard resource limits.

Source

pub fn with_limits( source: &'source str, limits: BatchLimits, ) -> Result<Self, EditError>

Starts an empty batch with explicit hard resource limits.

Source

pub fn push(&mut self, edit: ByteEdit) -> Result<(), EditError>

Admits one edit or leaves the batch unchanged on failure.

Source

pub fn push_batch(&mut self, edits: Vec<ByteEdit>) -> Result<(), EditError>

Admits every edit atomically, preserving input order at equal offsets.

Source

pub fn finish(self) -> Result<PreparedEdits<'source>, EditError>

Consumes the builder without cloning replacement strings.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl<'source> Debug for ByteEditBatch<'source>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'source> Freeze for ByteEditBatch<'source>

§

impl<'source> RefUnwindSafe for ByteEditBatch<'source>

§

impl<'source> Send for ByteEditBatch<'source>

§

impl<'source> Sync for ByteEditBatch<'source>

§

impl<'source> Unpin for ByteEditBatch<'source>

§

impl<'source> UnsafeUnpin for ByteEditBatch<'source>

§

impl<'source> UnwindSafe for ByteEditBatch<'source>

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, 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.