pub trait FluentString: Sized {
Show 14 methods
    // Required methods
    fn f_clear(self) -> Self;
    fn f_insert(self, idx: usize, ch: char) -> Self;
    fn f_insert_str(self, idx: usize, string: &str) -> Self;
    fn f_push(self, ch: char) -> Self;
    fn f_push_str(self, string: &str) -> Self;
    fn f_replace_range<R>(self, range: R, replace_with: &str) -> Self
       where R: RangeBounds<usize>;
    fn f_reserve(self, additional: usize) -> Self;
    fn f_reserve_exact(self, additional: usize) -> Self;
    fn f_retain<F>(self, f: F) -> Self
       where F: FnMut(char) -> bool;
    fn f_shrink_to(self, min_capacity: usize) -> Self;
    fn f_shrink_to_fit(self) -> Self;
    fn f_truncate(self, new_len: usize) -> Self;
    fn f_try_reserve(self, additional: usize) -> Result<Self, TryReserveError>;
    fn f_try_reserve_exact(
        self,
        additional: usize,
    ) -> Result<Self, TryReserveError>;
}Expand description
A trait that provides fluent versions of String mutation
methods, allowing for a fluent construction of strings.
§Examples
use fluent_string::*;
assert_eq!("my string".to_owned()
    .f_push_str(" is a bit longer now")
    .f_insert_str(12,", maybe,")
    .f_truncate(33),
    "my string is, maybe, a bit longer");Required Methods§
Sourcefn f_insert_str(self, idx: usize, string: &str) -> Self
 
fn f_insert_str(self, idx: usize, string: &str) -> Self
As String::insert_str except returns self
Sourcefn f_push_str(self, string: &str) -> Self
 
fn f_push_str(self, string: &str) -> Self
As String::push_str except returns self
Sourcefn f_replace_range<R>(self, range: R, replace_with: &str) -> Selfwhere
    R: RangeBounds<usize>,
 
fn f_replace_range<R>(self, range: R, replace_with: &str) -> Selfwhere
    R: RangeBounds<usize>,
As String::replace_range except returns self
Sourcefn f_reserve_exact(self, additional: usize) -> Self
 
fn f_reserve_exact(self, additional: usize) -> Self
As String::reserve_exact except returns self
Sourcefn f_shrink_to(self, min_capacity: usize) -> Self
 
fn f_shrink_to(self, min_capacity: usize) -> Self
As String::shrink_to except returns self
Sourcefn f_shrink_to_fit(self) -> Self
 
fn f_shrink_to_fit(self) -> Self
As String::shrink_to_fit except returns self
Sourcefn f_truncate(self, new_len: usize) -> Self
 
fn f_truncate(self, new_len: usize) -> Self
As String::truncate except returns self
Sourcefn f_try_reserve(self, additional: usize) -> Result<Self, TryReserveError>
 
fn f_try_reserve(self, additional: usize) -> Result<Self, TryReserveError>
As String::try_reserve except returns Result<Self, TryReserveError>
§Errors
See String::try_reserve_exact
Sourcefn f_try_reserve_exact(self, additional: usize) -> Result<Self, TryReserveError>
 
fn f_try_reserve_exact(self, additional: usize) -> Result<Self, TryReserveError>
As String::try_reserve_exact except returns Result<Self, TryReserveError>
§Errors
See String::try_reserve_exact
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl FluentString for &mut String
Fluent versions of all &mut std::string:String mutation methods that
otherwise return nothing.
 
impl FluentString for &mut String
Fluent versions of all &mut std::string:String mutation methods that
otherwise return nothing.
fn f_clear(self) -> Self
fn f_insert(self, idx: usize, ch: char) -> Self
fn f_insert_str(self, idx: usize, string: &str) -> Self
fn f_push(self, ch: char) -> Self
fn f_push_str(self, string: &str) -> Self
fn f_replace_range<R>(self, range: R, replace_with: &str) -> Selfwhere
    R: RangeBounds<usize>,
fn f_reserve(self, additional: usize) -> Self
fn f_reserve_exact(self, additional: usize) -> Self
fn f_retain<F>(self, f: F) -> Self
fn f_shrink_to(self, min_capacity: usize) -> Self
fn f_shrink_to_fit(self) -> Self
fn f_truncate(self, new_len: usize) -> Self
fn f_try_reserve(self, additional: usize) -> Result<Self, TryReserveError>
fn f_try_reserve_exact(self, additional: usize) -> Result<Self, TryReserveError>
Source§impl FluentString for String
Fluent versions of all std::string:String mutation methods that
otherwise return nothing.
 
impl FluentString for String
Fluent versions of all std::string:String mutation methods that
otherwise return nothing.