pub struct StringBuilder { /* private fields */ }
Expand description
A builder that can be used to efficiently build
nvim_oxi::String
s.
Implementations§
Source§impl StringBuilder
impl StringBuilder
Sourcepub fn push_bytes(&mut self, bytes: &[u8])
pub fn push_bytes(&mut self, bytes: &[u8])
Push new bytes to the builder.
When only pushing bytes once, prefer NvimString::from_bytes
as this
method may allocate extra space in the buffer.
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Initialize StringBuilder
with capacity.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserve space for additional
more bytes.
Does not allocate if enough space is available.
Sourcepub fn reserve_exact(&mut self, additional: usize)
pub fn reserve_exact(&mut self, additional: usize)
Reserve space for exactly additional
more bytes.
Does not allocate if enough space is available.
Sourcepub fn finish(self) -> NvimString
pub fn finish(self) -> NvimString
Finish building the NvimString
Trait Implementations§
Source§impl Default for StringBuilder
impl Default for StringBuilder
Source§impl Drop for StringBuilder
impl Drop for StringBuilder
Auto Trait Implementations§
impl Freeze for StringBuilder
impl RefUnwindSafe for StringBuilder
impl !Send for StringBuilder
impl !Sync for StringBuilder
impl Unpin for StringBuilder
impl UnwindSafe for StringBuilder
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
Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§type Error = Infallible
type Error = Infallible
The error type in the returned
Result
.Source§fn into_result(self) -> Result<T, <T as IntoResult<T>>::Error>
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Error>
Converts the value into a
Result
.