pub trait StringBuilder<'a>: Sized {
// Required methods
fn push_str(&mut self, s: &'a str);
fn push_char(&mut self, c: char);
fn from_str(s: &'a str) -> Self;
// Provided method
fn empty() -> Self { ... }
}Expand description
Helper trait for parsing strings with escape sequences. Allows for returning borrowed strings without any allocation if there are no escape sequences, or for recognizing strings without doing actual parsing / allocation.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<'a> StringBuilder<'a> for ()
The empty tuple can be used as a string builder in cases where it’s only
necessary to recognize a string and not to parse it
impl<'a> StringBuilder<'a> for ()
The empty tuple can be used as a string builder in cases where it’s only necessary to recognize a string and not to parse it
Source§impl<'a> StringBuilder<'a> for String
Strings can, of course, be built
impl<'a> StringBuilder<'a> for String
Strings can, of course, be built