pub struct SmolStrBuilder(/* private fields */);Expand description
A builder that can be used to efficiently build a SmolStr.
This won’t allocate if the final string fits into the inline buffer.
Implementations§
Source§impl SmolStrBuilder
impl SmolStrBuilder
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new empty SmolStrBuilder.
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new empty SmolStrBuilder with at least the specified capacity.
If capacity is less than or equal to SmolStr::INLINE_CAP, the builder
will use inline storage and not allocate. Otherwise, it will pre-allocate a
heap buffer of the requested capacity.
Trait Implementations§
Source§impl Clone for SmolStrBuilder
impl Clone for SmolStrBuilder
Source§impl Debug for SmolStrBuilder
impl Debug for SmolStrBuilder
Source§impl Default for SmolStrBuilder
impl Default for SmolStrBuilder
impl Eq for SmolStrBuilder
Source§impl<'a> Extend<&'a String> for SmolStrBuilder
impl<'a> Extend<&'a String> for SmolStrBuilder
Source§fn extend<I: IntoIterator<Item = &'a String>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = &'a String>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<'a> Extend<&'a str> for SmolStrBuilder
impl<'a> Extend<&'a str> for SmolStrBuilder
Source§fn extend<I: IntoIterator<Item = &'a str>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = &'a str>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl Extend<char> for SmolStrBuilder
impl Extend<char> for SmolStrBuilder
Source§fn extend<I: IntoIterator<Item = char>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = char>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl From<SmolStrBuilder> for SmolStr
impl From<SmolStrBuilder> for SmolStr
Source§fn from(value: SmolStrBuilder) -> Self
fn from(value: SmolStrBuilder) -> Self
Converts to this type from the input type.
Source§impl PartialEq for SmolStrBuilder
impl PartialEq for SmolStrBuilder
Auto Trait Implementations§
impl Freeze for SmolStrBuilder
impl RefUnwindSafe for SmolStrBuilder
impl Send for SmolStrBuilder
impl Sync for SmolStrBuilder
impl Unpin for SmolStrBuilder
impl UnsafeUnpin for SmolStrBuilder
impl UnwindSafe for SmolStrBuilder
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