[][src]Struct refactory_string::RefactoryString

pub struct RefactoryString<'a>(_);

A RefactoryBuffer specialization that only accepts and returns UTF-8 strings. This is what should be used when modifying a source string/file content. It uses RefactoryBuffer and converts everything conveniently.

Methods

impl<'a> RefactoryString<'a>[src]

pub fn new(content: &'a str) -> RefactoryString<'a>[src]

Create a new RefactoryString from the content. Never owns the original content, but owns every changes made to it.

pub fn len(&self) -> usize[src]

The original length of the content it contains.

pub fn to_string(&self) -> Result<String, Error>[src]

Serialize the changes to a string.

pub fn append_left(&mut self, index: usize, content: &str) -> Result<(), Error>[src]

Append the content to the left of the index.

pub fn prepend_left(&mut self, index: usize, content: &str) -> Result<(), Error>[src]

Prepend the content to the left of the index.

pub fn append_right(&mut self, index: usize, content: &str) -> Result<(), Error>[src]

Append the content to the right of the index.

pub fn prepend_right(
    &mut self,
    index: usize,
    content: &str
) -> Result<(), Error>
[src]

Prepend the content to the right of the index.

pub fn prepend(&mut self, content: &str) -> Result<(), Error>[src]

Prepend the content to the whole RefactoryString.

pub fn append(&mut self, content: &str) -> Result<(), Error>[src]

Append the content to the whole RefactoryString.

pub fn overwrite(
    &mut self,
    start: usize,
    end: usize,
    content: &str
) -> Result<(), Error>
[src]

Overwrite the content at the indices [start, end].

pub fn remove(&mut self, start: usize, end: usize) -> Result<(), Error>[src]

Remove the content between two indices.

Auto Trait Implementations

impl<'a> RefUnwindSafe for RefactoryString<'a>

impl<'a> Send for RefactoryString<'a>

impl<'a> Sync for RefactoryString<'a>

impl<'a> Unpin for RefactoryString<'a>

impl<'a> UnwindSafe for RefactoryString<'a>

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.