D64

Struct D64 

Source
pub struct D64 { /* private fields */ }
Expand description

64-bit fixed-point decimal with 8 decimal places of precision.

Range: ±92,233,720,368.54775807 Precision: 0.00000001

Implementations§

Source§

impl D64

Source

pub const SCALE: i64 = 100_000_000i64

The scale factor: 10^8

Source

pub const DECIMALS: u8 = 8u8

The number of decimal places

Source

pub const MAX: Self

Maximum value: ~92 billion

Source

pub const MIN: Self

Minimum value: ~-92 billion

Source

pub const ZERO: Self

Zero

Source

pub const ONE: Self

One (1.0)

Source

pub const TEN: Self

Ten (10.0)

Source

pub const HUNDRED: Self

One hundred (100.0)

Source

pub const THOUSAND: Self

One thousand (1000.0)

Source

pub const CENT: Self

One cent (0.01) - USD, EUR, and most currency smallest unit

Source

pub const MIL: Self

One mil (0.001) - used in some pricing contexts

Source

pub const BASIS_POINT: Self

One basis point (0.0001) - 1 bps, common in interest rates

Source

pub const HALF_BASIS_POINT: Self

One half basis point (0.00005)

Source

pub const QUARTER_BASIS_POINT: Self

One quarter basis point (0.000025)

Source

pub const THIRTY_SECOND: Self

One thirty-second (1/32 = 0.03125) - US Treasury bond price tick

Source

pub const SIXTY_FOURTH: Self

One sixty-fourth (1/64 = 0.015625) - US Treasury bond price tick

Source

pub const HALF_THIRTY_SECOND: Self = Self::SIXTY_FOURTH

One half of a thirty-second (1/64) - alternative name

Source

pub const QUARTER_THIRTY_SECOND: Self

One quarter of a thirty-second (1/128 = 0.0078125)

Source

pub const EIGHTH_THIRTY_SECOND: Self

One eighth of a thirty-second (1/256 = 0.00390625)

Source

pub const EIGHTH: Self

One eighth (0.125) - legacy stock pricing increment

Source

pub const SIXTEENTH: Self

One sixteenth (0.0625) - legacy stock pricing increment

Source

pub const QUARTER: Self

One quarter (0.25)

Source

pub const HALF: Self

One half (0.5)

Source

pub const PERCENT: Self = Self::CENT

One percent (0.01) - same as CENT but semantic clarity

Source

pub const TEN_BPS: Self = Self::MIL

Ten basis points (0.001) - same as MIL

Source

pub const HUNDRED_BPS: Self = Self::PERCENT

One hundred basis points (0.01) - same as PERCENT

Source§

impl D64

Source

pub const fn from_raw(value: i64) -> Self

Creates a new D64 from a raw scaled value.

§Safety

The caller must ensure the value is properly scaled by 10^8.

Source

pub const fn to_raw(self) -> i64

Returns the raw internal value (scaled by 10^8).

Source

pub const fn new(integer: i64, fractional: i64) -> Self

Creates a D64 from integer and fractional parts at compile time Example: new(123, 45_000_000) → 123.45

The fractional part should always be positive. For negative numbers, use a negative integer part: new(-123, 45_000_000) → -123.45

§Panics

Panics if the value would overflow i64 range.

Source

pub const fn from_basis_points(bps: i64) -> Option<Self>

Create from basis points (1 bp = 0.0001) Example: from_basis_points(100) → 0.01 (1%)

Source

pub const fn to_basis_points(self) -> i64

Convert to basis points Example: D64::from_str("0.01").unwrap().to_basis_points() → 100

Source

pub fn with_scale(mantissa: i64, scale: u32) -> Self

Creates a D64 from a mantissa and scale (like rust_decimal).

The scale represents the number of decimal places. For example: with_scale(12345, 2) = 123.45

§Panics

Panics if:

  • The scale is greater than 8 (our max precision)
  • The resulting value is out of bounds for D64
Source

pub const fn try_with_scale(mantissa: i64, scale: u32) -> Option<Self>

Creates a D64 from a mantissa and scale, returning None on error.

Like with_scale but returns None instead of panicking.

Source

pub fn with_scale_lossy(mantissa: i64, scale: u32) -> Self

Creates a D64 from a mantissa and scale, rounding if necessary.

If the scale is greater than 8, the mantissa will be divided by 10^(scale-8) to fit our precision, rounding to the nearest even number (banker’s rounding).

§Panics

Panics if the resulting value (after rounding) is out of bounds for D64.

Source

pub const fn try_with_scale_lossy(mantissa: i64, scale: u32) -> Option<Self>

Creates a D64 from a mantissa and scale, rounding if necessary, returns None on error.

Like with_scale_lossy but returns None instead of panicking on overflow.

Source§

impl D64

Source

pub const fn checked_add(self, rhs: Self) -> Option<Self>

Checked addition. Returns None if overflow occurred.

Source

pub const fn saturating_add(self, rhs: Self) -> Self

Saturating addition. Clamps on overflow.

Source

pub const fn wrapping_add(self, rhs: Self) -> Self

Wrapping addition. Wraps on overflow.

Source

pub const fn try_add(self, rhs: Self) -> Result<Self>

Checked addition. Returns an error if overflow occurred.

Source§

impl D64

Source

pub const fn checked_sub(self, rhs: Self) -> Option<Self>

Checked subtraction. Returns None if overflow occurred.

Source

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

Saturating subtraction. Clamps on overflow.

Source

pub const fn wrapping_sub(self, rhs: Self) -> Self

Wrapping subtraction. Wraps on overflow.

Source

pub const fn try_sub(self, rhs: Self) -> Result<Self>

Checked subtraction. Returns an error if overflow occurred.

Source§

impl D64

Source

pub const fn checked_mul(self, rhs: Self) -> Option<Self>

Fast multiplication using reciprocal division

Source

pub const fn saturating_mul(self, rhs: Self) -> Self

Source

pub const fn wrapping_mul(self, rhs: Self) -> Self

Source

pub const fn try_mul(self, rhs: Self) -> Result<Self>

Checked multiplication. Returns an error if overflow occurred.

Source

pub const fn mul_i64(self, rhs: i64) -> Option<Self>

Multiply by an integer (faster than general multiplication) Useful for: quantity * price, shares * rate, etc.

Source

pub const fn try_mul_i64(self, rhs: i64) -> Result<Self>

Source

pub const fn mul_add(self, mul: Self, add: Self) -> Option<Self>

Computes (self * mul) + add with only one rounding step More accurate and faster than separate mul + add

Source§

impl D64

Source

pub const fn checked_div(self, rhs: Self) -> Option<Self>

Checked division. Returns None if rhs is zero or overflow occurred.

Internally widens to i128 to maintain precision.

Source

pub const fn saturating_div(self, rhs: Self) -> Self

Saturating division. Clamps on overflow. Returns zero if rhs is zero.

Source

pub const fn wrapping_div(self, rhs: Self) -> Self

Wrapping division. Wraps on overflow. Returns zero if rhs is zero.

Source

pub const fn try_div(self, rhs: Self) -> Result<Self>

Checked division. Returns an error if rhs is zero or overflow occurred.

Source§

impl D64

Source

pub const fn checked_neg(self) -> Option<Self>

Checked negation. Returns None if the result would overflow.

Source

pub const fn saturating_neg(self) -> Self

Saturating negation. Clamps on overflow.

Source

pub const fn wrapping_neg(self) -> Self

Wrapping negation. Wraps on overflow.

Source

pub const fn try_neg(self) -> Result<Self>

Checked negation. Returns an error if overflow occurred.

Source§

impl D64

Source

pub const fn abs(self) -> Self

Returns the absolute value of self.

Source

pub const fn checked_abs(self) -> Option<Self>

Checked absolute value. Returns None if the result would overflow.

Source

pub const fn saturating_abs(self) -> Self

Saturating absolute value. Clamps on overflow.

Source

pub const fn wrapping_abs(self) -> Self

Wrapping absolute value. Wraps on overflow.

Source

pub const fn try_abs(self) -> Result<Self>

Checked absolute value. Returns an error if overflow occurred.

Source§

impl D64

Source

pub const fn is_positive(self) -> bool

Returns true if self is positive.

Source

pub const fn is_negative(self) -> bool

Returns true if self is negative.

Source

pub const fn is_zero(self) -> bool

Returns true if self is zero.

Source

pub const fn signum(self) -> i32

Returns the sign of self as -1, 0, or 1.

Source§

impl D64

Source

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

Returns the minimum of two values.

Source

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

Returns the maximum of two values.

Source

pub const fn clamp(self, min: Self, max: Self) -> Self

Restricts a value to a certain interval.

Returns max if self is greater than max, and min if self is less than min. Otherwise returns self.

§Panics

Panics if min > max.

Source§

impl D64

Source

pub const fn floor(self) -> Self

Returns the largest integer less than or equal to self.

Source

pub const fn ceil(self) -> Self

Returns the smallest integer greater than or equal to self.

Source

pub const fn trunc(self) -> Self

Returns the integer part of self, truncating any fractional part.

Source

pub const fn fract(self) -> Self

Returns the fractional part of self.

Source

pub const fn round(self) -> Self

Rounds to the nearest integer, using banker’s rounding (round half to even).

Source

pub const fn round_dp(self, decimal_places: u8) -> Self

Rounds to the specified number of decimal places.

§Arguments
  • decimal_places - Number of decimal places to round to (0-8 for D64)
§Panics

Panics if decimal_places > Self::DECIMALS

Source§

impl D64

Source

pub const fn recip(self) -> Option<Self>

Returns the reciprocal (multiplicative inverse) of self.

Returns None if self is zero.

Source

pub const fn try_recip(self) -> Result<Self>

Checked reciprocal. Returns an error if self is zero.

Source

pub const fn powi(self, exp: i32) -> Option<Self>

Raises self to an integer power.

Returns None if overflow occurs.

§Performance

Uses exponentiation by squaring for efficiency.

Source

pub const fn try_powi(self, exp: i32) -> Result<Self>

Checked integer power. Returns an error if overflow occurred.

Source

pub const fn sqrt(self) -> Option<Self>

Returns the square root of self using Newton’s method.

Returns None if self is negative.

§Performance

Uses a maximum of 20 iterations of Newton’s method. Typically converges in 5-10 iterations for most values.

Source

pub const fn try_sqrt(self) -> Result<Self>

Checked square root. Returns an error if self is negative.

Source§

impl D64

Source

pub const fn from_i64(value: i64) -> Option<Self>

Creates a D64 from an i64 integer.

Source

pub const fn from_i32(value: i32) -> Self

Creates a D64 from an i32 integer (always succeeds).

Source

pub const fn from_u32(value: u32) -> Self

Creates a D64 from a u32 integer (always succeeds).

Source

pub const fn from_u64(value: u64) -> Option<Self>

Creates a D64 from a u64 integer.

Source

pub const fn to_i64(self) -> i64

Converts to i64, truncating any fractional part.

Source

pub const fn to_i64_round(self) -> i64

Converts to i64, rounding to nearest (banker’s rounding on ties).

Source

pub const fn try_from_i64(value: i64) -> Result<Self>

Creates a D64 from an i64, returning an error on overflow.

Source

pub const fn try_from_u64(value: u64) -> Result<Self>

Creates a D64 from a u64, returning an error on overflow.

Source§

impl D64

Source

pub fn from_f64(value: f64) -> Option<Self>

Creates a D64 from an f64.

Returns None if the value is NaN, infinite, or out of range.

Source

pub fn to_f64(self) -> f64

Converts to f64.

Note: May lose precision for very large values.

Source

pub fn from_f32(value: f32) -> Option<Self>

Creates a D64 from an f32.

Source

pub fn to_f32(self) -> f32

Converts to f32.

Note: May lose precision.

Source

pub fn try_from_f64(value: f64) -> Result<Self>

Creates a D64 from an f64, returning an error if invalid.

Source§

impl D64

Source

pub fn percent_of(self, percent: Self) -> Option<Self>

Calculate percentage: self * (percent / 100) Example: 1000.percent_of(5) → 50 (5% of 1000)

Source

pub fn add_percent(self, percent: Self) -> Option<Self>

Add percentage: self * (1 + percent/100) Example: 1000.add_percent(5) → 1050 (add 5%)

Source§

impl D64

Source

pub fn from_str_exact(s: &str) -> Result<Self>

Parses a decimal string into a D64.

Supports formats like: “123”, “123.45”, “-123.45”, “0.00000001”

Zero-allocation implementation using iterators.

§Errors

Returns DecimalError::InvalidFormat if the string is not a valid decimal. Returns DecimalError::Overflow if the value is too large. Returns DecimalError::PrecisionLoss if more than 8 decimal places are provided.

Source

pub fn from_str_lossy(s: &str) -> Result<Self>

Parse a string, rounding to 8 decimal places if necessary

Unlike from_str_exact, this will succeed even if the input has more than 8 decimal places, rounding the excess digits using banker’s rounding.

Source

pub fn from_fixed_point_str(s: &str, decimals: u8) -> Result<Self>

Parse assuming a fixed number of decimals (no decimal point in string) E.g., parse_fixed_point_str(“12345”, 2) → 123.45

Source§

impl D64

Source

pub const BYTES: usize = 8usize

The size of this type in bytes.

Source

pub fn from_utf8_bytes(bytes: &[u8]) -> Result<Self>

Parse from byte slice (useful for binary protocols)

Source

pub const fn from_be_bytes(bytes: [u8; 8]) -> Self

Creates a D64 from its representation as a byte array in big endian.

Source

pub const fn from_le_bytes(bytes: [u8; 8]) -> Self

Creates a D64 from its representation as a byte array in little endian.

Source

pub const fn from_ne_bytes(bytes: [u8; 8]) -> Self

Creates a D64 from its representation as a byte array in native endian.

Source

pub const fn to_be_bytes(self) -> [u8; 8]

Returns the memory representation of this decimal as a byte array in big-endian byte order.

Source

pub const fn to_le_bytes(self) -> [u8; 8]

Returns the memory representation of this decimal as a byte array in little-endian byte order.

Source

pub const fn to_ne_bytes(self) -> [u8; 8]

Returns the memory representation of this decimal as a byte array in native byte order.

Source

pub fn write_le_bytes(&self, buf: &mut [u8])

Writes the decimal as bytes in little-endian order to the given buffer.

§Panics

Panics if buf.len() < 8.

Source

pub fn write_be_bytes(&self, buf: &mut [u8])

Writes the decimal as bytes in big-endian order to the given buffer.

§Panics

Panics if buf.len() < 8.

Source

pub fn write_ne_bytes(&self, buf: &mut [u8])

Writes the decimal as bytes in native-endian order to the given buffer.

§Panics

Panics if buf.len() < 8.

Source

pub fn read_le_bytes(buf: &[u8]) -> Self

Reads a decimal from bytes in little-endian order from the given buffer.

§Panics

Panics if buf.len() < 8.

Source

pub fn read_be_bytes(buf: &[u8]) -> Self

Reads a decimal from bytes in big-endian order from the given buffer.

§Panics

Panics if buf.len() < 8.

Source

pub fn read_ne_bytes(buf: &[u8]) -> Self

Reads a decimal from bytes in native-endian order from the given buffer.

§Panics

Panics if buf.len() < 8.

Source

pub fn try_write_le_bytes(&self, buf: &mut [u8]) -> Option<()>

Tries to write the decimal as bytes in little-endian order to the given buffer.

Returns None if buf.len() < 8.

Source

pub fn try_write_be_bytes(&self, buf: &mut [u8]) -> Option<()>

Tries to write the decimal as bytes in big-endian order to the given buffer.

Returns None if buf.len() < 8.

Source

pub fn try_write_ne_bytes(&self, buf: &mut [u8]) -> Option<()>

Tries to write the decimal as bytes in native-endian order to the given buffer.

Returns None if buf.len() < 8.

Source

pub fn try_read_le_bytes(buf: &[u8]) -> Option<Self>

Tries to read a decimal from bytes in little-endian order from the given buffer.

Returns None if buf.len() < 8.

Source

pub fn try_read_be_bytes(buf: &[u8]) -> Option<Self>

Tries to read a decimal from bytes in big-endian order from the given buffer.

Returns None if buf.len() < 8.

Source

pub fn try_read_ne_bytes(buf: &[u8]) -> Option<Self>

Tries to read a decimal from bytes in native-endian order from the given buffer.

Returns None if buf.len() < 8.

Trait Implementations§

Source§

impl Add for D64

Source§

type Output = D64

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl AddAssign for D64

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl Clone for D64

Source§

fn clone(&self) -> D64

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 D64

Source§

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

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

impl Default for D64

Source§

fn default() -> Self

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

impl Display for D64

Source§

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

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

impl Div for D64

Source§

type Output = D64

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl DivAssign for D64

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl From<i16> for D64

Source§

fn from(value: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for D64

Source§

fn from(value: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for D64

Source§

fn from(value: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for D64

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for D64

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for D64

Source§

fn from(value: u8) -> Self

Converts to this type from the input type.
Source§

impl FromStr for D64

Source§

type Err = DecimalError

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 D64

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 for D64

Source§

type Output = D64

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl MulAssign for D64

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl Neg for D64

Source§

type Output = D64

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Ord for D64

Source§

fn cmp(&self, other: &D64) -> 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 for D64

Source§

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

Source§

fn partial_cmp(&self, other: &D64) -> 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> Product<&'a D64> for D64

Source§

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

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl Product for D64

Source§

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

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl Sub for D64

Source§

type Output = D64

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl SubAssign for D64

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

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

Source§

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

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

impl Sum for D64

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 TryFrom<f32> for D64

Source§

type Error = DecimalError

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

fn try_from(value: f32) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<f64> for D64

Source§

type Error = DecimalError

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

fn try_from(value: f64) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<i64> for D64

Source§

type Error = DecimalError

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

fn try_from(value: i64) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<u64> for D64

Source§

type Error = DecimalError

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

fn try_from(value: u64) -> Result<Self>

Performs the conversion.
Source§

impl Copy for D64

Source§

impl Eq for D64

Source§

impl StructuralPartialEq for D64

Auto Trait Implementations§

§

impl Freeze for D64

§

impl RefUnwindSafe for D64

§

impl Send for D64

§

impl Sync for D64

§

impl Unpin for D64

§

impl UnwindSafe for D64

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.