Skip to main content

Str

Struct Str 

Source
pub struct Str { /* private fields */ }

Implementations§

Source§

impl Str

Source

pub fn of(s: impl Into<String>) -> Self

Source

pub fn slug(self) -> Self

Source

pub fn snake(self) -> Self

Source

pub fn camel(self) -> Self

Source

pub fn pascal(self) -> Self

Source

pub fn kebab(self) -> Self

Source

pub fn title(self) -> Self

Source

pub fn upper(self) -> Self

Source

pub fn lower(self) -> Self

Source

pub fn trim(self) -> Self

Source

pub fn ltrim(self) -> Self

Source

pub fn rtrim(self) -> Self

Source

pub fn squish(self) -> Self

Source

pub fn truncate(self, limit: usize) -> Self

Source

pub fn reverse(self) -> Self

Source

pub fn repeat(self, times: usize) -> Self

Source

pub fn append(self, s: &str) -> Self

Source

pub fn prepend(self, s: &str) -> Self

Source

pub fn replace(self, from: &str, to: &str) -> Self

Source

pub fn replace_first(self, from: &str, to: &str) -> Self

Source

pub fn replace_last(self, from: &str, to: &str) -> Self

Source

pub fn finish(self, cap: &str) -> Self

Source

pub fn ensure_start(self, prefix: &str) -> Self

Source

pub fn wrap(self, before: &str, after: &str) -> Self

Source

pub fn pad_left(self, n: usize) -> Self

Source

pub fn pad_right(self, n: usize) -> Self

Source

pub fn pad_both(self, n: usize) -> Self

Source

pub fn mask(self, mask_char: char, from: usize) -> Self

Source

pub fn escape_html(self) -> Self

Source

pub fn when(self, condition: bool, f: impl FnOnce(Self) -> Self) -> Self

Source

pub fn when_empty(self, f: impl FnOnce(Self) -> Self) -> Self

Source

pub fn when_not_empty(self, f: impl FnOnce(Self) -> Self) -> Self

Source

pub fn when_contains(self, needle: &str, f: impl FnOnce(Self) -> Self) -> Self

Source

pub fn when_starts_with( self, prefix: &str, f: impl FnOnce(Self) -> Self, ) -> Self

Source

pub fn when_ends_with(self, suffix: &str, f: impl FnOnce(Self) -> Self) -> Self

Source

pub fn tap(self, f: impl FnOnce(&str)) -> Self

Source

pub fn pipe<F: FnOnce(String) -> String>(self, f: F) -> Self

Source

pub fn to_string(self) -> String

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn contains(&self, needle: &str) -> bool

Source

pub fn starts_with(&self, prefix: &str) -> bool

Source

pub fn ends_with(&self, suffix: &str) -> bool

Source

pub fn word_count(&self) -> usize

Source

pub fn to_base64(self) -> String

Source

pub fn split(self, delimiter: &str) -> Vec<String>

Source

pub fn exactly(&self, other: &str) -> bool

Source

pub fn value(self) -> String

Trait Implementations§

Source§

impl Clone for Str

Source§

fn clone(&self) -> Str

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Str

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Str

Source§

fn eq(&self, other: &Str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Str

Source§

impl Send for Str

Source§

impl StructuralPartialEq for Str

Source§

impl Sync for Str

Auto Trait Implementations§

§

impl Freeze for Str

§

impl RefUnwindSafe for Str

§

impl Unpin for Str

§

impl UnsafeUnpin for Str

§

impl UnwindSafe for Str

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V