StrMath

Struct StrMath 

Source
pub struct StrMath<'a> { /* private fields */ }
Expand description

The main type that implements mathematical operations for strings.

Implementations§

Source§

impl StrMath<'static>

Source

pub const fn new() -> Self

Creates a new StrMath with an empty string slice.

Source§

impl<'a> StrMath<'a>

Source

pub const fn new_slice(s: &'a str) -> Self

Constructs a new StrMath with a string slice.

Source

pub const fn new_owned(s: String) -> Self

Constructs a new StrMath with an owned string value.

Source

pub fn into_owned(inst: Self) -> Self

Convert this StrMath into another StrMath with owned value.

Note: this is an associated function, which means that you have to call it as StrMath::into_owned(s) instead of s.into_owned(). This is so that there is no conflict with a method on the inner type.

Methods from Deref<Target = Cow<'a, str>>§

1.0.0 · Source

pub fn to_mut(&mut self) -> &mut <B as ToOwned>::Owned

Acquires a mutable reference to the owned form of the data.

Clones the data if it is not already owned.

§Examples
use std::borrow::Cow;

let mut cow = Cow::Borrowed("foo");
cow.to_mut().make_ascii_uppercase();

assert_eq!(
  cow,
  Cow::Owned(String::from("FOO")) as Cow<'_, str>
);

Trait Implementations§

Source§

impl<'a, T: 'a + ToMathStr<'a>> Add<T> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, T: 'a + ToMathStr<'a>> AddAssign<T> for StrMath<'a>

Source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
Source§

impl AsMut<String> for StrMath<'_>

Source§

fn as_mut(&mut self) -> &mut String

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<str> for StrMath<'_>

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a> Clone for StrMath<'a>

Source§

fn clone(&self) -> StrMath<'a>

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 StrMath<'_>

Source§

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

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

impl<'a> Default for StrMath<'a>

Source§

fn default() -> StrMath<'a>

Returns the “default value” for a type. Read more
Source§

impl<'a> Deref for StrMath<'a>

Source§

type Target = Cow<'a, str>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for StrMath<'_>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Display for StrMath<'_>

Source§

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

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

impl<'a> Div<&[char]> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &[char]) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<&'a str> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'a str) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<char> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: char) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> DivAssign<&'a [char]> for StrMath<'a>

Source§

fn div_assign(&mut self, rhs: &'a [char])

Performs the /= operation. Read more
Source§

impl<'a> DivAssign<&'a str> for StrMath<'a>

Source§

fn div_assign(&mut self, rhs: &'a str)

Performs the /= operation. Read more
Source§

impl DivAssign<char> for StrMath<'_>

Source§

fn div_assign(&mut self, rhs: char)

Performs the /= operation. Read more
Source§

impl DivAssign for StrMath<'_>

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl<'a> From<&'a str> for StrMath<'a>

Source§

fn from(value: &'a str) -> Self

Converts to this type from the input type.
Source§

impl<'a> Hash for StrMath<'a>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> Mul<isize> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: isize) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<usize> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: usize) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign<isize> for StrMath<'_>

Source§

fn mul_assign(&mut self, rhs: isize)

Performs the *= operation. Read more
Source§

impl MulAssign<usize> for StrMath<'_>

Source§

fn mul_assign(&mut self, rhs: usize)

Performs the *= operation. Read more
Source§

impl<'a> MulAssign for StrMath<'a>

Source§

fn mul_assign(&mut self, rhs: StrMath<'a>)

Performs the *= operation. Read more
Source§

impl Neg for StrMath<'_>

Source§

type Output = StrMath<'_>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Ord for StrMath<'_>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq<&str> for StrMath<'_>

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 PartialEq<str> for StrMath<'_>

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<'a> PartialEq for StrMath<'a>

Source§

fn eq(&self, other: &StrMath<'a>) -> 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 PartialOrd for StrMath<'_>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a> Rem<&[char]> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &[char]) -> Self::Output

Performs the % operation. Read more
Source§

impl<'a> Rem<&'a str> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &'a str) -> Self::Output

Performs the % operation. Read more
Source§

impl<'a> Rem<char> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: char) -> Self::Output

Performs the % operation. Read more
Source§

impl<'a> Rem for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Self) -> Self::Output

Performs the % operation. Read more
Source§

impl<'a> RemAssign<&'a [char]> for StrMath<'a>

Source§

fn rem_assign(&mut self, rhs: &'a [char])

Performs the %= operation. Read more
Source§

impl<'a> RemAssign<&'a str> for StrMath<'a>

Source§

fn rem_assign(&mut self, rhs: &'a str)

Performs the %= operation. Read more
Source§

impl RemAssign<char> for StrMath<'_>

Source§

fn rem_assign(&mut self, rhs: char)

Performs the %= operation. Read more
Source§

impl RemAssign for StrMath<'_>

Source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation. Read more
Source§

impl<'a> Shl<&StrMath<'_>> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: &StrMath<'_>) -> Self::Output

Performs the << operation. Read more
Source§

impl<'a> Shl<&String> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: &String) -> Self::Output

Performs the << operation. Read more
Source§

impl<'a> Shl<&str> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: &str) -> Self::Output

Performs the << operation. Read more
Source§

impl<'a> Shl<u128> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: u128) -> Self::Output

Performs the << operation. Read more
Source§

impl<'a> Shl<u16> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: u16) -> Self::Output

Performs the << operation. Read more
Source§

impl<'a> Shl<u32> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: u32) -> Self::Output

Performs the << operation. Read more
Source§

impl<'a> Shl<u64> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: u64) -> Self::Output

Performs the << operation. Read more
Source§

impl<'a> Shl<u8> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: u8) -> Self::Output

Performs the << operation. Read more
Source§

impl<'a> Shl<usize> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: usize) -> Self::Output

Performs the << operation. Read more
Source§

impl ShlAssign<&StrMath<'_>> for StrMath<'_>

Source§

fn shl_assign(&mut self, rhs: &StrMath<'_>)

Performs the <<= operation. Read more
Source§

impl ShlAssign<&String> for StrMath<'_>

Source§

fn shl_assign(&mut self, rhs: &String)

Performs the <<= operation. Read more
Source§

impl ShlAssign<&str> for StrMath<'_>

Source§

fn shl_assign(&mut self, rhs: &str)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u128> for StrMath<'_>

Source§

fn shl_assign(&mut self, rhs: u128)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u16> for StrMath<'_>

Source§

fn shl_assign(&mut self, rhs: u16)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u32> for StrMath<'_>

Source§

fn shl_assign(&mut self, rhs: u32)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u64> for StrMath<'_>

Source§

fn shl_assign(&mut self, rhs: u64)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u8> for StrMath<'_>

Source§

fn shl_assign(&mut self, rhs: u8)

Performs the <<= operation. Read more
Source§

impl ShlAssign<usize> for StrMath<'_>

Source§

fn shl_assign(&mut self, rhs: usize)

Performs the <<= operation. Read more
Source§

impl<'a> Shr<&StrMath<'_>> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: &StrMath<'_>) -> Self::Output

Performs the >> operation. Read more
Source§

impl<'a> Shr<&String> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: &String) -> Self::Output

Performs the >> operation. Read more
Source§

impl<'a> Shr<&str> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: &str) -> Self::Output

Performs the >> operation. Read more
Source§

impl<'a> Shr<u128> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: u128) -> Self::Output

Performs the >> operation. Read more
Source§

impl<'a> Shr<u16> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: u16) -> Self::Output

Performs the >> operation. Read more
Source§

impl<'a> Shr<u32> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: u32) -> Self::Output

Performs the >> operation. Read more
Source§

impl<'a> Shr<u64> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: u64) -> Self::Output

Performs the >> operation. Read more
Source§

impl<'a> Shr<u8> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: u8) -> Self::Output

Performs the >> operation. Read more
Source§

impl<'a> Shr<usize> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: usize) -> Self::Output

Performs the >> operation. Read more
Source§

impl ShrAssign<&StrMath<'_>> for StrMath<'_>

Source§

fn shr_assign(&mut self, rhs: &StrMath<'_>)

Performs the >>= operation. Read more
Source§

impl ShrAssign<&String> for StrMath<'_>

Source§

fn shr_assign(&mut self, rhs: &String)

Performs the >>= operation. Read more
Source§

impl ShrAssign<&str> for StrMath<'_>

Source§

fn shr_assign(&mut self, rhs: &str)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u128> for StrMath<'_>

Source§

fn shr_assign(&mut self, rhs: u128)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u16> for StrMath<'_>

Source§

fn shr_assign(&mut self, rhs: u16)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u32> for StrMath<'_>

Source§

fn shr_assign(&mut self, rhs: u32)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u64> for StrMath<'_>

Source§

fn shr_assign(&mut self, rhs: u64)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u8> for StrMath<'_>

Source§

fn shr_assign(&mut self, rhs: u8)

Performs the >>= operation. Read more
Source§

impl ShrAssign<usize> for StrMath<'_>

Source§

fn shr_assign(&mut self, rhs: usize)

Performs the >>= operation. Read more
Source§

impl<'a, T: ToMathStr<'a>> Sub<T> for StrMath<'a>

Source§

type Output = StrMath<'a>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, T: ToMathStr<'a>> SubAssign<T> for StrMath<'_>

Source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
Source§

impl<'a> ToMathStr<'a> for StrMath<'a>

Source§

fn to_math_str(self) -> StrMath<'a>

Convert this data into StrMath.
Source§

impl Write for StrMath<'_>

Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result

Glue for usage of the write! macro with implementors of this trait. Read more
Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
Source§

fn write_char(&mut self, c: char) -> Result

Writes a char into this writer, returning whether the write succeeded. Read more
Source§

impl<'a> Eq for StrMath<'a>

Source§

impl<'a> StructuralPartialEq for StrMath<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for StrMath<'a>

§

impl<'a> RefUnwindSafe for StrMath<'a>

§

impl<'a> Send for StrMath<'a>

§

impl<'a> Sync for StrMath<'a>

§

impl<'a> Unpin for StrMath<'a>

§

impl<'a> UnwindSafe for StrMath<'a>

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.