pub struct RefactoryString<'a> { /* private fields */ }
Expand description
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.
Implementations§
Source§impl<'a> RefactoryString<'a>
impl<'a> RefactoryString<'a>
Sourcepub fn new(content: &'a str) -> RefactoryString<'a>
pub fn new(content: &'a str) -> RefactoryString<'a>
Create a new RefactoryString from the content. Never owns the original content, but owns every changes made to it.
Sourcepub fn append_left(&mut self, index: usize, content: &str) -> Result<(), Error>
pub fn append_left(&mut self, index: usize, content: &str) -> Result<(), Error>
Append the content to the left of the index.
Sourcepub fn prepend_left(&mut self, index: usize, content: &str) -> Result<(), Error>
pub fn prepend_left(&mut self, index: usize, content: &str) -> Result<(), Error>
Prepend the content to the left of the index.
Sourcepub fn append_right(&mut self, index: usize, content: &str) -> Result<(), Error>
pub fn append_right(&mut self, index: usize, content: &str) -> Result<(), Error>
Append the content to the right of the index.
Sourcepub fn prepend_right(
&mut self,
index: usize,
content: &str,
) -> Result<(), Error>
pub fn prepend_right( &mut self, index: usize, content: &str, ) -> Result<(), Error>
Prepend the content to the right of the index.
Sourcepub fn prepend(&mut self, content: &str) -> Result<(), Error>
pub fn prepend(&mut self, content: &str) -> Result<(), Error>
Prepend the content to the whole RefactoryString.
Sourcepub fn append(&mut self, content: &str) -> Result<(), Error>
pub fn append(&mut self, content: &str) -> Result<(), Error>
Append the content to the whole RefactoryString.
Auto Trait Implementations§
impl<'a> Freeze for RefactoryString<'a>
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more