pub struct StringBuilder { /* private fields */ }Expand description
A mutable string builder with convenient push methods.
Accumulates string fragments and can be finalised into a String.
Supports indentation tracking for pretty-printing.
Implementations§
Source§impl StringBuilder
impl StringBuilder
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Create a StringBuilder with pre-allocated capacity.
Sourcepub fn set_indent_width(&mut self, w: usize) -> &mut Self
pub fn set_indent_width(&mut self, w: usize) -> &mut Self
Set the number of spaces per indent level (default: 2).
Trait Implementations§
Source§impl Clone for StringBuilder
impl Clone for StringBuilder
Source§fn clone(&self) -> StringBuilder
fn clone(&self) -> StringBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StringBuilder
impl Debug for StringBuilder
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 From<StringBuilder> for String
impl From<StringBuilder> for String
Source§fn from(sb: StringBuilder) -> String
fn from(sb: StringBuilder) -> String
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for StringBuilder
impl RefUnwindSafe for StringBuilder
impl Send for StringBuilder
impl Sync for StringBuilder
impl Unpin for StringBuilder
impl UnsafeUnpin 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