Struct cosmwasm_std::SignedDecimal

source ·
pub struct SignedDecimal(/* private fields */);
Expand description

A signed fixed-point decimal value with 18 fractional digits, i.e. SignedDecimal(1_000_000_000_000_000_000) == 1.0

The greatest possible value that can be represented is 170141183460469231731.687303715884105727 (which is (2^127 - 1) / 10^18) and the smallest is -170141183460469231731.687303715884105728 (which is -2^127 / 10^18).

Implementations§

source§

impl SignedDecimal

source

pub const DECIMAL_PLACES: u32 = 18u32

The number of decimal places. Since decimal types are fixed-point rather than floating-point, this is a constant.

source

pub const MAX: Self = _

The largest value that can be represented by this signed decimal type.

§Examples
assert_eq!(SignedDecimal::MAX.to_string(), "170141183460469231731.687303715884105727");
source

pub const MIN: Self = _

The smallest value that can be represented by this signed decimal type.

§Examples
assert_eq!(SignedDecimal::MIN.to_string(), "-170141183460469231731.687303715884105728");
source

pub const fn new(value: Int128) -> Self

Creates a SignedDecimal(value) This is equivalent to SignedDecimal::from_atomics(value, 18) but usable in a const context.

§Examples
assert_eq!(SignedDecimal::new(Int128::one()).to_string(), "0.000000000000000001");
source

pub const fn raw(value: i128) -> Self

Creates a SignedDecimal(Int128(value)) This is equivalent to SignedDecimal::from_atomics(value, 18) but usable in a const context.

§Examples
assert_eq!(SignedDecimal::raw(1234i128).to_string(), "0.000000000000001234");
source

pub const fn one() -> Self

Create a 1.0 SignedDecimal

source

pub const fn negative_one() -> Self

Create a -1.0 SignedDecimal

source

pub const fn zero() -> Self

Create a 0.0 SignedDecimal

source

pub fn percent(x: i64) -> Self

Convert x% into SignedDecimal

source

pub fn permille(x: i64) -> Self

Convert permille (x/1000) into SignedDecimal

source

pub fn bps(x: i64) -> Self

Convert basis points (x/10000) into SignedDecimal

source

pub fn from_atomics( atomics: impl Into<Int128>, decimal_places: u32 ) -> Result<Self, SignedDecimalRangeExceeded>

Creates a signed decimal from a number of atomic units and the number of decimal places. The inputs will be converted internally to form a signed decimal with 18 decimal places. So the input 123 and 2 will create the decimal 1.23.

Using 18 decimal places is slightly more efficient than other values as no internal conversion is necessary.

§Examples
let a = SignedDecimal::from_atomics(Int128::new(1234), 3).unwrap();
assert_eq!(a.to_string(), "1.234");

let a = SignedDecimal::from_atomics(1234i128, 0).unwrap();
assert_eq!(a.to_string(), "1234");

let a = SignedDecimal::from_atomics(1i64, 18).unwrap();
assert_eq!(a.to_string(), "0.000000000000000001");

let a = SignedDecimal::from_atomics(-1i64, 18).unwrap();
assert_eq!(a.to_string(), "-0.000000000000000001");
source

pub fn from_ratio( numerator: impl Into<Int128>, denominator: impl Into<Int128> ) -> Self

Returns the ratio (numerator / denominator) as a SignedDecimal

§Examples
assert_eq!(
    SignedDecimal::from_ratio(1, 3).to_string(),
    "0.333333333333333333"
);
source

pub fn checked_from_ratio( numerator: impl Into<Int128>, denominator: impl Into<Int128> ) -> Result<Self, CheckedFromRatioError>

Returns the ratio (numerator / denominator) as a SignedDecimal

§Examples
assert_eq!(
    SignedDecimal::checked_from_ratio(1, 3).unwrap().to_string(),
    "0.333333333333333333"
);
assert_eq!(
    SignedDecimal::checked_from_ratio(1, 0),
    Err(CheckedFromRatioError::DivideByZero)
);
source

pub const fn is_zero(&self) -> bool

Returns true if the number is 0

source

pub const fn is_negative(&self) -> bool

Returns true if the number is negative (< 0)

source

pub const fn atomics(&self) -> Int128

A decimal is an integer of atomic units plus a number that specifies the position of the decimal dot. So any decimal can be expressed as two numbers.

§Examples
// Value with whole and fractional part
let a = SignedDecimal::from_str("1.234").unwrap();
assert_eq!(a.decimal_places(), 18);
assert_eq!(a.atomics(), Int128::new(1234000000000000000));

// Smallest possible value
let b = SignedDecimal::from_str("0.000000000000000001").unwrap();
assert_eq!(b.decimal_places(), 18);
assert_eq!(b.atomics(), Int128::new(1));
source

pub const fn decimal_places(&self) -> u32

The number of decimal places. This is a constant value for now but this could potentially change as the type evolves.

See also SignedDecimal::atomics().

source

pub fn trunc(&self) -> Self

Rounds value by truncating the decimal places.

§Examples
assert!(SignedDecimal::from_str("0.6").unwrap().trunc().is_zero());
assert_eq!(SignedDecimal::from_str("-5.8").unwrap().trunc().to_string(), "-5");
source

pub fn floor(&self) -> Self

Rounds value down after decimal places. Panics on overflow.

§Examples
assert!(SignedDecimal::from_str("0.6").unwrap().floor().is_zero());
assert_eq!(SignedDecimal::from_str("-5.2").unwrap().floor().to_string(), "-6");
source

pub fn checked_floor(&self) -> Result<Self, RoundDownOverflowError>

Rounds value down after decimal places.

source

pub fn ceil(&self) -> Self

Rounds value up after decimal places. Panics on overflow.

§Examples
assert_eq!(SignedDecimal::from_str("0.2").unwrap().ceil(), SignedDecimal::one());
assert_eq!(SignedDecimal::from_str("-5.8").unwrap().ceil().to_string(), "-5");
source

pub fn checked_ceil(&self) -> Result<Self, RoundUpOverflowError>

Rounds value up after decimal places. Returns OverflowError on overflow.

source

pub fn checked_add(self, other: Self) -> Result<Self, OverflowError>

Computes self + other, returning an OverflowError if an overflow occurred.

source

pub fn checked_sub(self, other: Self) -> Result<Self, OverflowError>

Computes self - other, returning an OverflowError if an overflow occurred.

source

pub fn checked_mul(self, other: Self) -> Result<Self, OverflowError>

Multiplies one SignedDecimal by another, returning an OverflowError if an overflow occurred.

source

pub fn pow(self, exp: u32) -> Self

Raises a value to the power of exp, panics if an overflow occurred.

source

pub fn checked_pow(self, exp: u32) -> Result<Self, OverflowError>

Raises a value to the power of exp, returning an OverflowError if an overflow occurred.

source

pub fn checked_div(self, other: Self) -> Result<Self, CheckedFromRatioError>

source

pub fn checked_rem(self, other: Self) -> Result<Self, DivideByZeroError>

Computes self % other, returning an DivideByZeroError if other == 0.

source

pub const fn abs_diff(self, other: Self) -> Decimal

source

pub fn saturating_add(self, other: Self) -> Self

source

pub fn saturating_sub(self, other: Self) -> Self

source

pub fn saturating_mul(self, other: Self) -> Self

source

pub fn saturating_pow(self, exp: u32) -> Self

source

pub fn to_int_floor(self) -> Int128

Converts this decimal to a signed integer by rounding down to the next integer, e.g. 22.5 becomes 22 and -1.2 becomes -2.

§Examples
use core::str::FromStr;
use cosmwasm_std::{SignedDecimal, Int128};

let d = SignedDecimal::from_str("12.345").unwrap();
assert_eq!(d.to_int_floor(), Int128::new(12));

let d = SignedDecimal::from_str("-12.999").unwrap();
assert_eq!(d.to_int_floor(), Int128::new(-13));

let d = SignedDecimal::from_str("-0.05").unwrap();
assert_eq!(d.to_int_floor(), Int128::new(-1));
source

pub fn to_int_trunc(self) -> Int128

Converts this decimal to a signed integer by truncating the fractional part, e.g. 22.5 becomes 22.

§Examples
use core::str::FromStr;
use cosmwasm_std::{SignedDecimal, Int128};

let d = SignedDecimal::from_str("12.345").unwrap();
assert_eq!(d.to_int_trunc(), Int128::new(12));

let d = SignedDecimal::from_str("-12.999").unwrap();
assert_eq!(d.to_int_trunc(), Int128::new(-12));

let d = SignedDecimal::from_str("75.0").unwrap();
assert_eq!(d.to_int_trunc(), Int128::new(75));
source

pub fn to_int_ceil(self) -> Int128

Converts this decimal to a signed integer by rounding up to the next integer, e.g. 22.3 becomes 23 and -1.2 becomes -1.

§Examples
use core::str::FromStr;
use cosmwasm_std::{SignedDecimal, Int128};

let d = SignedDecimal::from_str("12.345").unwrap();
assert_eq!(d.to_int_ceil(), Int128::new(13));

let d = SignedDecimal::from_str("-12.999").unwrap();
assert_eq!(d.to_int_ceil(), Int128::new(-12));

let d = SignedDecimal::from_str("75.0").unwrap();
assert_eq!(d.to_int_ceil(), Int128::new(75));

Trait Implementations§

source§

impl Add<&SignedDecimal> for &SignedDecimal

§

type Output = <SignedDecimal as Add>::Output

The resulting type after applying the + operator.
source§

fn add( self, other: &SignedDecimal ) -> <SignedDecimal as Add<SignedDecimal>>::Output

Performs the + operation. Read more
source§

impl Add<&SignedDecimal> for SignedDecimal

§

type Output = <SignedDecimal as Add>::Output

The resulting type after applying the + operator.
source§

fn add( self, other: &SignedDecimal ) -> <SignedDecimal as Add<SignedDecimal>>::Output

Performs the + operation. Read more
source§

impl<'a> Add<SignedDecimal> for &'a SignedDecimal

§

type Output = <SignedDecimal as Add>::Output

The resulting type after applying the + operator.
source§

fn add( self, other: SignedDecimal ) -> <SignedDecimal as Add<SignedDecimal>>::Output

Performs the + operation. Read more
source§

impl Add for SignedDecimal

§

type Output = SignedDecimal

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl AddAssign<&SignedDecimal> for SignedDecimal

source§

fn add_assign(&mut self, other: &SignedDecimal)

Performs the += operation. Read more
source§

impl AddAssign for SignedDecimal

source§

fn add_assign(&mut self, rhs: SignedDecimal)

Performs the += operation. Read more
source§

impl Clone for SignedDecimal

source§

fn clone(&self) -> SignedDecimal

Returns a copy 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 SignedDecimal

source§

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

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

impl Default for SignedDecimal

source§

fn default() -> SignedDecimal

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

impl<'de> Deserialize<'de> for SignedDecimal

Deserializes as a base64 string

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 SignedDecimal

source§

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

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

impl Div<&SignedDecimal> for &SignedDecimal

§

type Output = <SignedDecimal as Div>::Output

The resulting type after applying the / operator.
source§

fn div( self, other: &SignedDecimal ) -> <SignedDecimal as Div<SignedDecimal>>::Output

Performs the / operation. Read more
source§

impl Div<&SignedDecimal> for SignedDecimal

§

type Output = <SignedDecimal as Div>::Output

The resulting type after applying the / operator.
source§

fn div( self, other: &SignedDecimal ) -> <SignedDecimal as Div<SignedDecimal>>::Output

Performs the / operation. Read more
source§

impl Div<Int128> for SignedDecimal

§

type Output = SignedDecimal

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl<'a> Div<SignedDecimal> for &'a SignedDecimal

§

type Output = <SignedDecimal as Div>::Output

The resulting type after applying the / operator.
source§

fn div( self, other: SignedDecimal ) -> <SignedDecimal as Div<SignedDecimal>>::Output

Performs the / operation. Read more
source§

impl Div for SignedDecimal

§

type Output = SignedDecimal

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl DivAssign<&SignedDecimal> for SignedDecimal

source§

fn div_assign(&mut self, other: &SignedDecimal)

Performs the /= operation. Read more
source§

impl DivAssign<Int128> for SignedDecimal

source§

fn div_assign(&mut self, rhs: Int128)

Performs the /= operation. Read more
source§

impl DivAssign for SignedDecimal

source§

fn div_assign(&mut self, rhs: SignedDecimal)

Performs the /= operation. Read more
source§

impl Fraction<Int128> for SignedDecimal

source§

fn inv(&self) -> Option<Self>

Returns the multiplicative inverse 1/d for decimal d.

If d is zero, none is returned.

source§

fn numerator(&self) -> Int128

Returns the numerator p
source§

fn denominator(&self) -> Int128

Returns the denominator q
source§

impl From<SignedDecimal> for SignedDecimal256

source§

fn from(value: SignedDecimal) -> Self

Converts to this type from the input type.
source§

impl FromStr for SignedDecimal

source§

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

Converts the decimal string to a SignedDecimal Possible inputs: “1.23”, “1”, “000012”, “1.123000000”, “-1.12300” Disallowed: “”, “.23”

This never performs any kind of rounding. More than DECIMAL_PLACES fractional digits, even zeros, result in an error.

§

type Err = StdError

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

impl JsonSchema for SignedDecimal

source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
source§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
source§

impl Mul<&SignedDecimal> for &SignedDecimal

§

type Output = <SignedDecimal as Mul>::Output

The resulting type after applying the * operator.
source§

fn mul( self, other: &SignedDecimal ) -> <SignedDecimal as Mul<SignedDecimal>>::Output

Performs the * operation. Read more
source§

impl Mul<&SignedDecimal> for SignedDecimal

§

type Output = <SignedDecimal as Mul>::Output

The resulting type after applying the * operator.
source§

fn mul( self, other: &SignedDecimal ) -> <SignedDecimal as Mul<SignedDecimal>>::Output

Performs the * operation. Read more
source§

impl<'a> Mul<SignedDecimal> for &'a SignedDecimal

§

type Output = <SignedDecimal as Mul>::Output

The resulting type after applying the * operator.
source§

fn mul( self, other: SignedDecimal ) -> <SignedDecimal as Mul<SignedDecimal>>::Output

Performs the * operation. Read more
source§

impl Mul for SignedDecimal

§

type Output = SignedDecimal

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl MulAssign<&SignedDecimal> for SignedDecimal

source§

fn mul_assign(&mut self, other: &SignedDecimal)

Performs the *= operation. Read more
source§

impl MulAssign for SignedDecimal

source§

fn mul_assign(&mut self, rhs: SignedDecimal)

Performs the *= operation. Read more
source§

impl Neg for SignedDecimal

§

type Output = SignedDecimal

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl Ord for SignedDecimal

source§

fn cmp(&self, other: &SignedDecimal) -> 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 + PartialOrd,

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

impl PartialEq<&SignedDecimal> for SignedDecimal

source§

fn eq(&self, rhs: &&SignedDecimal) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<SignedDecimal> for &'a SignedDecimal

source§

fn eq(&self, rhs: &SignedDecimal) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for SignedDecimal

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for SignedDecimal

source§

fn partial_cmp(&self, other: &SignedDecimal) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Rem<&SignedDecimal> for &SignedDecimal

§

type Output = <SignedDecimal as Rem>::Output

The resulting type after applying the % operator.
source§

fn rem( self, other: &SignedDecimal ) -> <SignedDecimal as Rem<SignedDecimal>>::Output

Performs the % operation. Read more
source§

impl Rem<&SignedDecimal> for SignedDecimal

§

type Output = <SignedDecimal as Rem>::Output

The resulting type after applying the % operator.
source§

fn rem( self, other: &SignedDecimal ) -> <SignedDecimal as Rem<SignedDecimal>>::Output

Performs the % operation. Read more
source§

impl<'a> Rem<SignedDecimal> for &'a SignedDecimal

§

type Output = <SignedDecimal as Rem>::Output

The resulting type after applying the % operator.
source§

fn rem( self, other: SignedDecimal ) -> <SignedDecimal as Rem<SignedDecimal>>::Output

Performs the % operation. Read more
source§

impl Rem for SignedDecimal

source§

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

§Panics

This operation will panic if rhs is zero

§

type Output = SignedDecimal

The resulting type after applying the % operator.
source§

impl RemAssign<&SignedDecimal> for SignedDecimal

source§

fn rem_assign(&mut self, other: &SignedDecimal)

Performs the %= operation. Read more
source§

impl RemAssign for SignedDecimal

source§

fn rem_assign(&mut self, rhs: SignedDecimal)

Performs the %= operation. Read more
source§

impl Serialize for SignedDecimal

Serializes as a decimal string

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

§

type Output = <SignedDecimal as Sub>::Output

The resulting type after applying the - operator.
source§

fn sub( self, other: &SignedDecimal ) -> <SignedDecimal as Sub<SignedDecimal>>::Output

Performs the - operation. Read more
source§

impl Sub<&SignedDecimal> for SignedDecimal

§

type Output = <SignedDecimal as Sub>::Output

The resulting type after applying the - operator.
source§

fn sub( self, other: &SignedDecimal ) -> <SignedDecimal as Sub<SignedDecimal>>::Output

Performs the - operation. Read more
source§

impl<'a> Sub<SignedDecimal> for &'a SignedDecimal

§

type Output = <SignedDecimal as Sub>::Output

The resulting type after applying the - operator.
source§

fn sub( self, other: SignedDecimal ) -> <SignedDecimal as Sub<SignedDecimal>>::Output

Performs the - operation. Read more
source§

impl Sub for SignedDecimal

§

type Output = SignedDecimal

The resulting type after applying the - operator.
source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
source§

impl SubAssign<&SignedDecimal> for SignedDecimal

source§

fn sub_assign(&mut self, other: &SignedDecimal)

Performs the -= operation. Read more
source§

impl SubAssign for SignedDecimal

source§

fn sub_assign(&mut self, rhs: SignedDecimal)

Performs the -= operation. Read more
source§

impl<A> Sum<A> for SignedDecimal
where Self: Add<A, Output = Self>,

source§

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

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl TryFrom<Decimal> for SignedDecimal

§

type Error = SignedDecimalRangeExceeded

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

fn try_from(value: Decimal) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Decimal256> for SignedDecimal

§

type Error = SignedDecimalRangeExceeded

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

fn try_from(value: Decimal256) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<SignedDecimal> for Decimal

§

type Error = DecimalRangeExceeded

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

fn try_from(value: SignedDecimal) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<SignedDecimal> for Decimal256

§

type Error = Decimal256RangeExceeded

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

fn try_from(value: SignedDecimal) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<SignedDecimal256> for SignedDecimal

§

type Error = SignedDecimalRangeExceeded

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

fn try_from(value: SignedDecimal256) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Copy for SignedDecimal

source§

impl Eq for SignedDecimal

source§

impl StructuralPartialEq for SignedDecimal

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<U> As for U

source§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. 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> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

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

§

type Output = T

Should always be Self
source§

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

§

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§

default 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>,

§

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>,

§

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>,

source§

impl<T, Rhs, Output> GroupOps<Rhs, Output> for T
where T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + AddAssign<Rhs> + SubAssign<Rhs>,

source§

impl<T, Rhs, Output> GroupOpsOwned<Rhs, Output> for T
where T: for<'r> GroupOps<&'r Rhs, Output>,

source§

impl<T, Rhs, Output> ScalarMul<Rhs, Output> for T
where T: Mul<Rhs, Output = Output> + MulAssign<Rhs>,

source§

impl<T, Rhs, Output> ScalarMulOwned<Rhs, Output> for T
where T: for<'r> ScalarMul<&'r Rhs, Output>,