Skip to main content

BigInt

Struct BigInt 

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

Native arbitrary-precision signed integer.

Represented as a Sign plus a non-negative BigUint magnitude. The canonical-zero invariant guarantees a unique representation of zero (always Sign::Positive + BigUint::ZERO).

Implementations§

Source§

impl BigInt

Source

pub fn to_signed_bytes_be(&self) -> Vec<u8>

Returns the two’s-complement big-endian byte representation of this value, using the minimal number of bytes.

§Examples
use oxinum_int::native::BigInt;

assert_eq!(BigInt::from(0i64).to_signed_bytes_be(), vec![0u8]);
assert_eq!(BigInt::from(1i64).to_signed_bytes_be(), vec![1u8]);
assert_eq!(BigInt::from(-1i64).to_signed_bytes_be(), vec![0xFFu8]);
assert_eq!(BigInt::from(127i64).to_signed_bytes_be(), vec![0x7Fu8]);
assert_eq!(BigInt::from(-128i64).to_signed_bytes_be(), vec![0x80u8]);
assert_eq!(BigInt::from(128i64).to_signed_bytes_be(), vec![0x00u8, 0x80]);
assert_eq!(BigInt::from(129i64).to_signed_bytes_be(), vec![0x00u8, 0x81]);
assert_eq!(BigInt::from(-129i64).to_signed_bytes_be(), vec![0xFFu8, 0x7F]);
Source

pub fn to_signed_bytes_le(&self) -> Vec<u8>

Returns the two’s-complement little-endian byte representation of this value, using the minimal number of bytes.

§Examples
use oxinum_int::native::BigInt;

assert_eq!(BigInt::from(0i64).to_signed_bytes_le(), vec![0u8]);
assert_eq!(BigInt::from(1i64).to_signed_bytes_le(), vec![1u8]);
assert_eq!(BigInt::from(-1i64).to_signed_bytes_le(), vec![0xFFu8]);
assert_eq!(BigInt::from(128i64).to_signed_bytes_le(), vec![0x80u8, 0x00]);
assert_eq!(BigInt::from(-129i64).to_signed_bytes_le(), vec![0x7Fu8, 0xFF]);
Source

pub fn from_signed_bytes_be(bytes: &[u8]) -> BigInt

Construct a BigInt from a two’s-complement big-endian byte slice.

An empty slice decodes as zero.

§Examples
use oxinum_int::native::BigInt;

assert_eq!(BigInt::from_signed_bytes_be(&[]), BigInt::zero());
assert_eq!(BigInt::from_signed_bytes_be(&[0x00]), BigInt::zero());
assert_eq!(BigInt::from_signed_bytes_be(&[0x01]), BigInt::from(1i64));
assert_eq!(BigInt::from_signed_bytes_be(&[0xFF]), BigInt::from(-1i64));
assert_eq!(BigInt::from_signed_bytes_be(&[0x80]), BigInt::from(-128i64));
assert_eq!(BigInt::from_signed_bytes_be(&[0xFF, 0x7F]), BigInt::from(-129i64));
Source

pub fn from_signed_bytes_le(bytes: &[u8]) -> BigInt

Construct a BigInt from a two’s-complement little-endian byte slice.

An empty slice decodes as zero.

§Examples
use oxinum_int::native::BigInt;

assert_eq!(BigInt::from_signed_bytes_le(&[]), BigInt::zero());
assert_eq!(BigInt::from_signed_bytes_le(&[0xFF]), BigInt::from(-1i64));
assert_eq!(BigInt::from_signed_bytes_le(&[0x7F, 0xFF]), BigInt::from(-129i64));
Source§

impl BigInt

Source

pub const ZERO: BigInt

The canonical zero value (+0).

Source

pub fn zero() -> BigInt

Construct a zero BigInt.

§Examples
use oxinum_int::native::BigInt;
assert!(BigInt::zero().is_zero());
Source

pub fn one() -> BigInt

Construct a BigInt equal to 1.

§Examples
use oxinum_int::native::BigInt;
assert!(BigInt::one().is_one());
Source

pub fn from_parts(sign: Sign, mag: BigUint) -> BigInt

Construct from an existing (sign, magnitude) pair. Re-canonicalizes zero so that BigInt::from_parts(Sign::Negative, BigUint::ZERO) is indistinguishable from BigInt::zero().

§Examples
use oxinum_int::native::{BigInt, BigUint};
use oxinum_core::Sign;
let a = BigInt::from_parts(Sign::Negative, BigUint::from_u64(7));
assert_eq!(format!("{a}"), "-7");

// -0 canonicalizes to +0.
let neg_zero = BigInt::from_parts(Sign::Negative, BigUint::ZERO);
assert_eq!(neg_zero, BigInt::zero());
Source

pub fn into_parts(self) -> (Sign, BigUint)

Decompose into (sign, magnitude). For zero, the returned sign is always Sign::Positive.

§Examples
use oxinum_int::native::{BigInt, BigUint};
use oxinum_core::Sign;
let n = BigInt::from(-42i64);
let (s, m) = n.into_parts();
assert_eq!(s, Sign::Negative);
assert_eq!(m, BigUint::from_u64(42));
Source

pub fn sign(&self) -> Sign

Returns the sign of this number. For zero, returns Sign::Positive (canonical-zero invariant).

Source

pub fn signum(&self) -> Sign

Returns the sign as a method that follows the standard signum convention: +1, -1, or 0-as-Positive. Use Self::sign for the raw sign enum.

§Examples
use oxinum_int::native::BigInt;
use oxinum_core::Sign;
assert_eq!(BigInt::from(5i64).signum(), Sign::Positive);
assert_eq!(BigInt::from(-3i64).signum(), Sign::Negative);
// Zero is canonically positive in dashu_base::Sign.
assert_eq!(BigInt::zero().signum(), Sign::Positive);
Source

pub fn magnitude(&self) -> &BigUint

Returns a reference to the magnitude (always non-negative).

Source

pub fn abs(&self) -> BigInt

Returns the absolute value as a non-negative BigInt.

§Examples
use oxinum_int::native::BigInt;
assert_eq!(BigInt::from(-42i64).abs(), BigInt::from(42i64));
assert_eq!(BigInt::from(42i64).abs(), BigInt::from(42i64));
Source

pub fn is_zero(&self) -> bool

Returns true if this value is zero.

Source

pub fn is_one(&self) -> bool

Returns true if this value is +1 (sign positive AND magnitude one).

Source

pub fn is_negative(&self) -> bool

Returns true if this value is strictly negative.

Source

pub fn is_positive(&self) -> bool

Returns true if this value is strictly positive.

Source§

impl BigInt

Source

pub fn nth_root(&self, n: u32) -> Result<BigInt, OxiNumError>

Integer n-th root for signed values.

  • n == 0: error (OxiNumError::Precision).
  • Negative self with even n: error (no real even root of a negative integer).
  • Negative self with odd n: returns the unique negative root.
  • Otherwise: floor of the positive real root.
§Examples
use oxinum_int::native::BigInt;
assert_eq!(BigInt::from(-8i64).nth_root(3).unwrap(), BigInt::from(-2i64));
assert_eq!(BigInt::from(27i64).nth_root(3).unwrap(), BigInt::from(3i64));
assert!(BigInt::from(-4i64).nth_root(2).is_err());
assert!(BigInt::from(10i64).nth_root(0).is_err());
Source

pub fn sqrt(&self) -> Result<BigInt, OxiNumError>

Integer square root for signed values. Errors for negative inputs.

§Examples
use oxinum_int::native::BigInt;
assert_eq!(BigInt::from(49i64).sqrt().unwrap(), BigInt::from(7i64));
assert!(BigInt::from(-1i64).sqrt().is_err());

Trait Implementations§

Source§

impl Add for BigInt

Source§

type Output = BigInt

The resulting type after applying the + operator.
Source§

fn add(self, rhs: BigInt) -> BigInt

Performs the + operation. Read more
Source§

impl Add<&BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &BigInt) -> BigInt

Performs the + operation. Read more
Source§

impl Add<&BigInt> for BigInt

Source§

type Output = BigInt

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &BigInt) -> BigInt

Performs the + operation. Read more
Source§

impl Add<BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the + operator.
Source§

fn add(self, rhs: BigInt) -> BigInt

Performs the + operation. Read more
Source§

impl AddAssign for BigInt

Source§

fn add_assign(&mut self, rhs: BigInt)

Performs the += operation. Read more
Source§

impl AddAssign<&BigInt> for BigInt

Source§

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

Performs the += operation. Read more
Source§

impl Binary for BigInt

Source§

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

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

impl BitAnd for BigInt

Source§

type Output = BigInt

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: BigInt) -> BigInt

Performs the & operation. Read more
Source§

impl BitAnd<&BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &BigInt) -> BigInt

Performs the & operation. Read more
Source§

impl BitAnd<&BigInt> for BigInt

Source§

type Output = BigInt

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &BigInt) -> BigInt

Performs the & operation. Read more
Source§

impl BitAnd<BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: BigInt) -> BigInt

Performs the & operation. Read more
Source§

impl BitOr for BigInt

Source§

type Output = BigInt

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: BigInt) -> BigInt

Performs the | operation. Read more
Source§

impl BitOr<&BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &BigInt) -> BigInt

Performs the | operation. Read more
Source§

impl BitOr<&BigInt> for BigInt

Source§

type Output = BigInt

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &BigInt) -> BigInt

Performs the | operation. Read more
Source§

impl BitOr<BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: BigInt) -> BigInt

Performs the | operation. Read more
Source§

impl BitXor for BigInt

Source§

type Output = BigInt

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: BigInt) -> BigInt

Performs the ^ operation. Read more
Source§

impl BitXor<&BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &BigInt) -> BigInt

Performs the ^ operation. Read more
Source§

impl BitXor<&BigInt> for BigInt

Source§

type Output = BigInt

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &BigInt) -> BigInt

Performs the ^ operation. Read more
Source§

impl BitXor<BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: BigInt) -> BigInt

Performs the ^ operation. Read more
Source§

impl Clone for BigInt

Source§

fn clone(&self) -> BigInt

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BigInt

Source§

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

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

impl Default for BigInt

Source§

fn default() -> BigInt

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

impl Display for BigInt

Source§

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

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

impl Div for BigInt

Source§

type Output = BigInt

The resulting type after applying the / operator.
Source§

fn div(self, rhs: BigInt) -> BigInt

Performs the / operation. Read more
Source§

impl Div<&BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &BigInt) -> BigInt

Performs the / operation. Read more
Source§

impl Div<&BigInt> for BigInt

Source§

type Output = BigInt

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &BigInt) -> BigInt

Performs the / operation. Read more
Source§

impl Div<BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the / operator.
Source§

fn div(self, rhs: BigInt) -> BigInt

Performs the / operation. Read more
Source§

impl DivAssign for BigInt

Source§

fn div_assign(&mut self, rhs: BigInt)

Performs the /= operation. Read more
Source§

impl DivAssign<&BigInt> for BigInt

Source§

fn div_assign(&mut self, rhs: &BigInt)

Performs the /= operation. Read more
Source§

impl Eq for BigInt

Source§

impl From<&BigInt> for BigRational

Source§

fn from(n: &BigInt) -> BigRational

Converts to this type from the input type.
Source§

impl From<&BigUint> for BigInt

Source§

fn from(m: &BigUint) -> BigInt

Converts to this type from the input type.
Source§

impl From<BigInt> for BigRational

Source§

fn from(n: BigInt) -> BigRational

Converts to this type from the input type.
Source§

impl From<BigUint> for BigInt

Source§

fn from(m: BigUint) -> BigInt

Converts to this type from the input type.
Source§

impl From<i8> for BigInt

Source§

fn from(v: i8) -> BigInt

Converts to this type from the input type.
Source§

impl From<i16> for BigInt

Source§

fn from(v: i16) -> BigInt

Converts to this type from the input type.
Source§

impl From<i32> for BigInt

Source§

fn from(v: i32) -> BigInt

Converts to this type from the input type.
Source§

impl From<i64> for BigInt

Source§

fn from(v: i64) -> BigInt

Converts to this type from the input type.
Source§

impl From<i128> for BigInt

Source§

fn from(v: i128) -> BigInt

Converts to this type from the input type.
Source§

impl From<isize> for BigInt

Source§

fn from(v: isize) -> BigInt

Converts to this type from the input type.
Source§

impl From<u8> for BigInt

Source§

fn from(v: u8) -> BigInt

Converts to this type from the input type.
Source§

impl From<u16> for BigInt

Source§

fn from(v: u16) -> BigInt

Converts to this type from the input type.
Source§

impl From<u32> for BigInt

Source§

fn from(v: u32) -> BigInt

Converts to this type from the input type.
Source§

impl From<u64> for BigInt

Source§

fn from(v: u64) -> BigInt

Converts to this type from the input type.
Source§

impl From<u128> for BigInt

Source§

fn from(v: u128) -> BigInt

Converts to this type from the input type.
Source§

impl From<usize> for BigInt

Source§

fn from(v: usize) -> BigInt

Converts to this type from the input type.
Source§

impl FromRadix for BigInt

Source§

fn from_radix(src: &str, radix: u32) -> Result<BigInt, OxiNumError>

Parse src in the given radix (2..=36). Read more
Source§

impl Hash for BigInt

Source§

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

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 LowerHex for BigInt

Source§

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

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

impl Mul for BigInt

Source§

type Output = BigInt

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: BigInt) -> BigInt

Performs the * operation. Read more
Source§

impl Mul<&BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &BigInt) -> BigInt

Performs the * operation. Read more
Source§

impl Mul<&BigInt> for BigInt

Source§

type Output = BigInt

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &BigInt) -> BigInt

Performs the * operation. Read more
Source§

impl Mul<BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: BigInt) -> BigInt

Performs the * operation. Read more
Source§

impl MulAssign for BigInt

Source§

fn mul_assign(&mut self, rhs: BigInt)

Performs the *= operation. Read more
Source§

impl MulAssign<&BigInt> for BigInt

Source§

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

Performs the *= operation. Read more
Source§

impl Neg for BigInt

Source§

type Output = BigInt

The resulting type after applying the - operator.
Source§

fn neg(self) -> BigInt

Performs the unary - operation. Read more
Source§

impl Neg for &BigInt

Source§

type Output = BigInt

The resulting type after applying the - operator.
Source§

fn neg(self) -> BigInt

Performs the unary - operation. Read more
Source§

impl Not for BigInt

Source§

type Output = BigInt

The resulting type after applying the ! operator.
Source§

fn not(self) -> BigInt

Performs the unary ! operation. Read more
Source§

impl Not for &BigInt

Source§

type Output = BigInt

The resulting type after applying the ! operator.
Source§

fn not(self) -> BigInt

Performs the unary ! operation. Read more
Source§

impl Octal for BigInt

Source§

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

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

impl Ord for BigInt

Source§

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

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

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

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

impl OxiNum for BigInt

Source§

fn is_zero(&self) -> bool

Returns true if this value is zero.
Source§

fn is_one(&self) -> bool

Returns true if this value is one.
Source§

impl OxiSigned for BigInt

Source§

fn signum(&self) -> Sign

Returns the sign of this number.
Source§

fn abs(&self) -> BigInt

Returns the absolute value.
Source§

fn is_negative(&self) -> bool

Returns true if this value is negative.
Source§

fn is_positive(&self) -> bool

Returns true if this value is positive (and not zero).
Source§

impl PartialEq for BigInt

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 BigInt

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 Pow<u32> for BigInt

Source§

type Output = BigInt

The output type.
Source§

fn pow(&self, exp: u32) -> BigInt

Raises self to the power exp.
Source§

impl Rem for BigInt

Source§

type Output = BigInt

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

impl Rem<&BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &BigInt) -> BigInt

Performs the % operation. Read more
Source§

impl Rem<&BigInt> for BigInt

Source§

type Output = BigInt

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &BigInt) -> BigInt

Performs the % operation. Read more
Source§

impl Rem<BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

impl RemAssign for BigInt

Source§

fn rem_assign(&mut self, rhs: BigInt)

Performs the %= operation. Read more
Source§

impl RemAssign<&BigInt> for BigInt

Source§

fn rem_assign(&mut self, rhs: &BigInt)

Performs the %= operation. Read more
Source§

impl Shl<u64> for BigInt

Source§

type Output = BigInt

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

fn shl(self, k: u64) -> BigInt

Performs the << operation. Read more
Source§

impl Shl<u64> for &BigInt

Source§

type Output = BigInt

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

fn shl(self, k: u64) -> BigInt

Performs the << operation. Read more
Source§

impl Shr<u64> for BigInt

Source§

type Output = BigInt

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

fn shr(self, k: u64) -> BigInt

Performs the >> operation. Read more
Source§

impl Shr<u64> for &BigInt

Source§

type Output = BigInt

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

fn shr(self, k: u64) -> BigInt

Performs the >> operation. Read more
Source§

impl Sub for BigInt

Source§

type Output = BigInt

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: BigInt) -> BigInt

Performs the - operation. Read more
Source§

impl Sub<&BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &BigInt) -> BigInt

Performs the - operation. Read more
Source§

impl Sub<&BigInt> for BigInt

Source§

type Output = BigInt

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &BigInt) -> BigInt

Performs the - operation. Read more
Source§

impl Sub<BigInt> for &BigInt

Source§

type Output = BigInt

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: BigInt) -> BigInt

Performs the - operation. Read more
Source§

impl SubAssign for BigInt

Source§

fn sub_assign(&mut self, rhs: BigInt)

Performs the -= operation. Read more
Source§

impl SubAssign<&BigInt> for BigInt

Source§

fn sub_assign(&mut self, rhs: &BigInt)

Performs the -= operation. Read more
Source§

impl ToRadix for BigInt

Source§

fn to_radix(&self, radix: u32) -> Result<String, OxiNumError>

Returns the string representation in the given radix (2..=36). Read more
Source§

impl UpperHex for BigInt

Source§

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

Formats the value using the given formatter. Read more

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.