Trait FluentString

Source
pub trait FluentString: Sized {
Show 17 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>; // Provided methods fn f_push_if<F>(self, ch: char, f: F) -> Self where F: Fn(&Self, char) -> bool { ... } fn f_push_str_if<F>(self, string: &str, f: F) -> Self where F: Fn(&Self, &str) -> bool { ... } fn f_truncate_if<F>(self, f: F) -> Self where F: Fn(&Self) -> Option<usize> { ... }
}

Required Methods§

Source

fn f_clear(self) -> Self

As String::clear except returns self

Source

fn f_insert(self, idx: usize, ch: char) -> Self

As String::insert except returns self

Source

fn f_insert_str(self, idx: usize, string: &str) -> Self

As String::insert_str except returns self

Source

fn f_push(self, ch: char) -> Self

As String::push except returns self

Source

fn f_push_str(self, string: &str) -> Self

As String::push_str except returns self

Source

fn f_replace_range<R>(self, range: R, replace_with: &str) -> Self
where R: RangeBounds<usize>,

As String::replace_range except returns self

Source

fn f_reserve(self, additional: usize) -> Self

As String::reserve except returns self

Source

fn f_reserve_exact(self, additional: usize) -> Self

As String::reserve_exact except returns self

Source

fn f_retain<F>(self, f: F) -> Self
where F: FnMut(char) -> bool,

As String::retain except returns self

Source

fn f_shrink_to(self, min_capacity: usize) -> Self

As String::shrink_to except returns self

Source

fn f_shrink_to_fit(self) -> Self

As String::shrink_to_fit except returns self

Source

fn f_truncate(self, new_len: usize) -> Self

As String::truncate except returns self

Source

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

Source

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

Provided Methods§

Source

fn f_push_if<F>(self, ch: char, f: F) -> Self
where F: Fn(&Self, char) -> bool,

As FluentString::f_push except only if f returns true

Source

fn f_push_str_if<F>(self, string: &str, f: F) -> Self
where F: Fn(&Self, &str) -> bool,

As FluentString::f_push_str except only if f returns true

Source

fn f_truncate_if<F>(self, f: F) -> Self
where F: Fn(&Self) -> Option<usize>,

As FluentString::f_truncate except only if f returns Some(usize)

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.

Source§

fn f_clear(self) -> Self

Source§

fn f_insert(self, idx: usize, ch: char) -> Self

Source§

fn f_insert_str(self, idx: usize, string: &str) -> Self

Source§

fn f_push(self, ch: char) -> Self

Source§

fn f_push_str(self, string: &str) -> Self

Source§

fn f_replace_range<R>(self, range: R, replace_with: &str) -> Self
where R: RangeBounds<usize>,

Source§

fn f_reserve(self, additional: usize) -> Self

Source§

fn f_reserve_exact(self, additional: usize) -> Self

Source§

fn f_retain<F>(self, f: F) -> Self
where F: FnMut(char) -> bool,

Source§

fn f_shrink_to(self, min_capacity: usize) -> Self

Source§

fn f_shrink_to_fit(self) -> Self

Source§

fn f_truncate(self, new_len: usize) -> Self

Source§

fn f_try_reserve(self, additional: usize) -> Result<Self, TryReserveError>

Source§

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.

Source§

fn f_clear(self) -> Self

Source§

fn f_insert(self, idx: usize, ch: char) -> Self

Source§

fn f_insert_str(self, idx: usize, string: &str) -> Self

Source§

fn f_push(self, ch: char) -> Self

Source§

fn f_push_str(self, string: &str) -> Self

Source§

fn f_replace_range<R>(self, range: R, replace_with: &str) -> Self
where R: RangeBounds<usize>,

Source§

fn f_reserve(self, additional: usize) -> Self

Source§

fn f_reserve_exact(self, additional: usize) -> Self

Source§

fn f_retain<F>(self, f: F) -> Self
where F: FnMut(char) -> bool,

Source§

fn f_shrink_to(self, min_capacity: usize) -> Self

Source§

fn f_shrink_to_fit(self) -> Self

Source§

fn f_truncate(self, new_len: usize) -> Self

Source§

fn f_try_reserve(self, additional: usize) -> Result<Self, TryReserveError>

Source§

fn f_try_reserve_exact(self, additional: usize) -> Result<Self, TryReserveError>

Implementors§