pub struct StringBuilder { /* private fields */ }Expand description
A builder that can be used to efficiently build
nvim_oxi::Strings.
Implementations§
Source§impl StringBuilder
impl StringBuilder
Sourcepub fn new() -> StringBuilder
pub fn new() -> StringBuilder
Create a new empty 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) -> StringBuilder
pub fn with_capacity(cap: usize) -> StringBuilder
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) -> String
pub fn finish(self) -> String
Finish building the NvimString
Trait Implementations§
Source§impl Default for StringBuilder
impl Default for StringBuilder
Source§fn default() -> StringBuilder
fn default() -> StringBuilder
Returns the “default value” for a type. Read more
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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.