Positive

Struct Positive 

Source
pub struct Positive(pub Decimal);
Expand description

A wrapper type that represents a guaranteed positive decimal value.

This type encapsulates a Decimal value and ensures through its API that the contained value is always positive (greater than or equal to zero).

Tuple Fields§

§0: Decimal

Implementations§

Source§

impl Positive

Source

pub const ZERO: Positive

A zero value represented as a Positive value.

Source

pub const ONE: Positive

A value of one represented as a Positive value.

Source

pub const TWO: Positive

A value of two represented as a Positive value.

Source

pub const INFINITY: Positive

Represents the maximum positive value possible (effectively infinity).

Source

pub const TEN: Positive

A value of ten represented as a Positive value.

Source

pub const HUNDRED: Positive

A value of one hundred represented as a Positive value.

Source

pub const THOUSAND: Positive

A value of one thousand represented as a Positive value.

Source

pub const PI: Positive

The mathematical constant π (pi) represented as a Positive value.

Source

pub const E: Positive

The mathematical constant e (Euler’s number) represented as a Positive value.

Source

pub fn new(value: f64) -> Result<Self, PositiveError>

Creates a new Positive value from a 64-bit floating-point number.

Source

pub fn new_decimal(value: Decimal) -> Result<Self, PositiveError>

Creates a new Positive value directly from a Decimal.

Source

pub fn value(&self) -> Decimal

Returns the inner Decimal value.

Source

pub fn to_dec(&self) -> Decimal

Returns the inner Decimal value (alias for value()).

Source

pub fn to_dec_ref(&self) -> &Decimal

Returns the inner Decimal ref.

Source

pub fn to_f64(&self) -> f64

Converts the value to a 64-bit floating-point number.

§Panics

This method will panic if the conversion fails. Use to_f64_checked() or to_f64_lossy() for non-panicking alternatives.

Source

pub fn to_f64_checked(&self) -> Option<f64>

Converts the value to f64, returning None if conversion fails.

Source

pub fn to_f64_lossy(&self) -> f64

Converts the value to f64 with lossy conversion (returns 0.0 on failure).

Source

pub fn to_i64(&self) -> i64

Converts the value to a 64-bit signed integer.

§Panics

This method will panic if the conversion fails. Use to_i64_checked() for a non-panicking alternative.

Source

pub fn to_i64_checked(&self) -> Option<i64>

Converts the value to i64, returning None if conversion fails.

Source

pub fn to_u64(&self) -> u64

Converts the inner value to a u64.

§Panics

This method will panic if the conversion fails. Use to_u64_checked() for a non-panicking alternative.

Source

pub fn to_u64_checked(&self) -> Option<u64>

Converts the value to u64, returning None if conversion fails.

Source

pub fn to_usize(&self) -> usize

Converts the value to a usize.

§Panics

This method will panic if the conversion fails. Use to_usize_checked() for a non-panicking alternative.

Source

pub fn to_usize_checked(&self) -> Option<usize>

Converts the value to usize, returning None if conversion fails.

Source

pub fn max(self, other: Positive) -> Positive

Returns the maximum of two Positive values.

Source

pub fn min(self, other: Positive) -> Positive

Returns the minimum of two Positive values.

Source

pub fn floor(&self) -> Positive

Rounds the value down to the nearest integer.

Source

pub fn powi(&self, n: i64) -> Positive

Raises this value to an integer power.

Source

pub fn pow(&self, n: Positive) -> Positive

Computes the result of raising the current value to the power of the given exponent.

Source

pub fn powu(&self, n: u64) -> Positive

Raises the current value to the power of n using unsigned integer exponentiation.

Source

pub fn powd(&self, p0: Decimal) -> Positive

Raises this value to a decimal power.

Source

pub fn round(&self) -> Positive

Rounds the value to the nearest integer.

Source

pub fn round_to_nice_number(&self) -> Positive

Rounds the current value to a “nice” number, based on its magnitude.

Source

pub fn sqrt(&self) -> Positive

Calculates the square root of the value.

§Panics

This method will panic if the square root calculation fails. Use sqrt_checked() for a non-panicking alternative.

Source

pub fn sqrt_checked(&self) -> Result<Positive, PositiveError>

Calculates the square root, returning an error if it fails.

Source

pub fn ln(&self) -> Positive

Calculates the natural logarithm of the value.

Source

pub fn round_to(&self, decimal_places: u32) -> Positive

Rounds the value to a specified number of decimal places.

Source

pub fn format_fixed_places(&self, decimal_places: u32) -> String

Formats the value with a fixed number of decimal places.

Source

pub fn exp(&self) -> Positive

Calculates the exponential function e^x for this value.

Source

pub fn clamp(&self, min: Positive, max: Positive) -> Positive

Clamps the value between a minimum and maximum.

Source

pub fn is_zero(&self) -> bool

Checks if the value is exactly zero.

Source

pub fn ceiling(&self) -> Positive

Returns the smallest integer greater than or equal to the value.

Source

pub fn log10(&self) -> Positive

Computes the base-10 logarithm of the value.

Source

pub fn sub_or_zero(&self, other: &Decimal) -> Positive

Subtracts a decimal value, returning zero if the result would be negative.

Source

pub fn sub_or_none(&self, other: &Decimal) -> Option<Positive>

Subtracts a decimal value, returning None if the result would be negative.

Source

pub fn checked_sub(&self, rhs: &Self) -> Result<Self, PositiveError>

Checked subtraction that returns Result instead of panicking.

Source

pub fn saturating_sub(&self, rhs: &Self) -> Self

Saturating subtraction that returns ZERO instead of negative.

Source

pub fn checked_div(&self, rhs: &Self) -> Result<Self, PositiveError>

Checked division that returns Result instead of panicking.

Source

pub fn is_multiple(&self, other: f64) -> bool

Checks whether the value is a multiple of another f64 value.

Source

pub fn is_multiple_of(&self, other: &Positive) -> bool

Checks whether the value is a multiple of another Positive value.

Trait Implementations§

Source§

impl AbsDiffEq for Positive

Source§

type Epsilon = Decimal

Used for specifying relative comparisons.
Source§

fn default_epsilon() -> Self::Epsilon

The default tolerance to use when testing values that are close together. Read more
Source§

fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
Source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of AbsDiffEq::abs_diff_eq.
Source§

impl Add<&Decimal> for Positive

Source§

type Output = Positive

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<&Positive> for Decimal

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Positive) -> Decimal

Performs the + operation. Read more
Source§

impl Add<Decimal> for Positive

Source§

type Output = Positive

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Decimal) -> Positive

Performs the + operation. Read more
Source§

impl Add<Positive> for Decimal

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Positive) -> Decimal

Performs the + operation. Read more
Source§

impl Add<Positive> for f64

Source§

type Output = f64

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<f64> for Positive

Source§

type Output = Positive

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add for Positive

Source§

type Output = Positive

The resulting type after applying the + operator.
Source§

fn add(self, other: Positive) -> Positive

Performs the + operation. Read more
Source§

impl AddAssign<&Positive> for Decimal

Source§

fn add_assign(&mut self, rhs: &Positive)

Performs the += operation. Read more
Source§

impl AddAssign<Decimal> for Positive

Source§

fn add_assign(&mut self, rhs: Decimal)

Performs the += operation. Read more
Source§

impl AddAssign<Positive> for Decimal

Source§

fn add_assign(&mut self, rhs: Positive)

Performs the += operation. Read more
Source§

impl AddAssign for Positive

Source§

fn add_assign(&mut self, other: Positive)

Performs the += operation. Read more
Source§

impl Clone for Positive

Source§

fn clone(&self) -> Positive

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 Positive

Source§

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

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

impl Default for Positive

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Positive

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Positive

Source§

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

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

impl Div<&Decimal> for Positive

Source§

type Output = Positive

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<Decimal> for Positive

Source§

type Output = Positive

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Decimal) -> Positive

Performs the / operation. Read more
Source§

impl Div<Positive> for Decimal

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Positive) -> Decimal

Performs the / operation. Read more
Source§

impl Div<Positive> for f64

Source§

type Output = f64

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<f64> for &Positive

Source§

type Output = Positive

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f64) -> Positive

Performs the / operation. Read more
Source§

impl Div<f64> for Positive

Source§

type Output = Positive

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f64) -> Positive

Performs the / operation. Read more
Source§

impl Div for &Positive

Source§

type Output = Positive

The resulting type after applying the / operator.
Source§

fn div(self, other: &Positive) -> Self::Output

Performs the / operation. Read more
Source§

impl Div for Positive

Source§

type Output = Positive

The resulting type after applying the / operator.
Source§

fn div(self, other: Positive) -> Self::Output

Performs the / operation. Read more
Source§

impl From<&Decimal> for Positive

Source§

fn from(value: &Decimal) -> Self

Converts to this type from the input type.
Source§

impl From<&Positive> for Decimal

Source§

fn from(pos: &Positive) -> Self

Converts to this type from the input type.
Source§

impl From<&Positive> for Positive

Source§

fn from(value: &Positive) -> Self

Converts to this type from the input type.
Source§

impl From<&Positive> for f64

Source§

fn from(value: &Positive) -> Self

Converts to this type from the input type.
Source§

impl From<Decimal> for Positive

Source§

fn from(value: Decimal) -> Self

Converts to this type from the input type.
Source§

impl From<Positive> for Decimal

Source§

fn from(value: Positive) -> Self

Converts to this type from the input type.
Source§

impl From<Positive> for f64

Source§

fn from(value: Positive) -> Self

Converts to this type from the input type.
Source§

impl From<Positive> for u64

Source§

fn from(pos_u64: Positive) -> Self

Converts to this type from the input type.
Source§

impl From<Positive> for usize

Source§

fn from(value: Positive) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Positive

Source§

fn from(value: f64) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for Positive

Source§

fn from(value: usize) -> Self

Converts to this type from the input type.
Source§

impl FromStr for Positive

Source§

type Err = String

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Positive

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 Mul<Decimal> for Positive

Source§

type Output = Positive

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Decimal) -> Positive

Performs the * operation. Read more
Source§

impl Mul<Positive> for Decimal

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Positive) -> Decimal

Performs the * operation. Read more
Source§

impl Mul<Positive> for f64

Source§

type Output = f64

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<f64> for Positive

Source§

type Output = Positive

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> Positive

Performs the * operation. Read more
Source§

impl Mul for Positive

Source§

type Output = Positive

The resulting type after applying the * operator.
Source§

fn mul(self, other: Positive) -> Positive

Performs the * operation. Read more
Source§

impl MulAssign<&Positive> for Decimal

Source§

fn mul_assign(&mut self, rhs: &Positive)

Performs the *= operation. Read more
Source§

impl MulAssign<Decimal> for Positive

Source§

fn mul_assign(&mut self, rhs: Decimal)

Performs the *= operation. Read more
Source§

impl MulAssign<Positive> for Decimal

Source§

fn mul_assign(&mut self, rhs: Positive)

Performs the *= operation. Read more
Source§

impl Neg for Positive

Source§

type Output = Positive

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Ord for Positive

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<&Positive> for Positive

Source§

fn eq(&self, other: &&Positive) -> 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<&Positive> for f64

Source§

fn eq(&self, other: &&Positive) -> 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<Decimal> for Positive

Source§

fn eq(&self, other: &Decimal) -> 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<Positive> for Decimal

Source§

fn eq(&self, other: &Positive) -> 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<Positive> for f64

Source§

fn eq(&self, other: &Positive) -> 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<f64> for &Positive

Source§

fn eq(&self, other: &f64) -> 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<f64> for Positive

Source§

fn eq(&self, other: &f64) -> 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 for Positive

Source§

fn eq(&self, other: &Positive) -> 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<&Positive> for f64

Source§

fn partial_cmp(&self, other: &&Positive) -> 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 PartialOrd<Decimal> for Positive

Source§

fn partial_cmp(&self, other: &Decimal) -> 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 PartialOrd<Positive> for f64

Source§

fn partial_cmp(&self, other: &Positive) -> 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 PartialOrd<f64> for &Positive

Source§

fn partial_cmp(&self, other: &f64) -> 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 PartialOrd<f64> for Positive

Source§

fn partial_cmp(&self, other: &f64) -> 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 PartialOrd for Positive

Source§

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

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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. 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 gt(&self, other: &Rhs) -> bool

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

impl RelativeEq for Positive

Source§

fn default_max_relative() -> Self::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
Source§

fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

A test for equality that uses a relative comparison if the values are far apart.
Source§

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

The inverse of RelativeEq::relative_eq.
Source§

impl Serialize for Positive

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Sub<&Decimal> for Positive

Source§

type Output = Positive

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<&Positive> for Decimal

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Positive) -> Decimal

Performs the - operation. Read more
Source§

impl Sub<Decimal> for Positive

Source§

type Output = Positive

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Decimal) -> Positive

Performs the - operation. Read more
Source§

impl Sub<Positive> for Decimal

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Positive) -> Decimal

Performs the - operation. Read more
Source§

impl Sub<Positive> for f64

Source§

type Output = f64

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<f64> for Positive

Source§

type Output = Positive

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub for Positive

Source§

type Output = Positive

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<'a> Sum<&'a Positive> for Positive

Source§

fn sum<I: Iterator<Item = &'a Positive>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl Sum for Positive

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl Copy for Positive

Source§

impl Eq for Positive

Source§

impl StructuralPartialEq for Positive

Auto Trait Implementations§

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> 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,