SparsePolynomial

Struct SparsePolynomial 

Source
pub struct SparsePolynomial<N> {
    pub terms: BTreeMap<usize, N>,
}
Expand description

A type which stores the terms of a polynomial in a map. It is intended to store the terms of polynomials where the degree is significantly larger than the number of non-zero terms. Operations are significantly slower than with Polynomial if the number of non-zero terms is very close to the degree.

Fields§

§terms: BTreeMap<usize, N>

Implementations§

Source§

impl SparsePolynomial<f64>

Source

pub fn roots(self) -> Roots<f64>

Return the roots of the SparsePolynomial.

§Example
use rustnomial::{SparsePolynomial, Roots, SizedPolynomial};
let zero = SparsePolynomial::<f64>::zero();
assert_eq!(Roots::InfiniteRoots, zero.roots());
let constant = SparsePolynomial::from(vec![1.]);
assert_eq!(Roots::NoRoots, constant.roots());
let monomial = SparsePolynomial::from(vec![1.0, 0.,]);
assert_eq!(Roots::ManyRealRoots(vec![0.]), monomial.roots());
let binomial = SparsePolynomial::from(vec![1.0, 2.0]);
assert_eq!(Roots::ManyRealRoots(vec![-2.0]), binomial.roots());
let trinomial = SparsePolynomial::from(vec![1.0, 4.0, 4.0]);
assert_eq!(Roots::ManyRealRoots(vec![-2.0, -2.0]), trinomial.roots());
let quadnomial = SparsePolynomial::from(vec![1.0, 6.0, 12.0, 8.0]);
assert_eq!(Roots::ManyRealRoots(vec![-2.0, -2.0, -2.0]), quadnomial.roots());
Source§

impl<N: Copy> SparsePolynomial<N>

Source

pub fn new(terms: BTreeMap<usize, N>) -> SparsePolynomial<N>

Source§

impl<N: Copy + Zero> SparsePolynomial<N>

Source

pub fn ordered_term_iter(&self) -> impl Iterator<Item = (N, usize)> + '_

Source§

impl<N> SparsePolynomial<N>
where N: Mul<Output = N> + AddAssign + Copy + Zero + One,

Source

pub fn borrow_mul(&self, rhs: &SparsePolynomial<N>) -> SparsePolynomial<N>

Source

pub fn pow(&self, exp: usize) -> SparsePolynomial<N>

Raises the SparsePolynomial to the power of exp, using exponentiation by squaring.

§Example
use rustnomial::SparsePolynomial;
let polynomial = SparsePolynomial::from(vec![1.0, 2.0]);
let polynomial_sqr = polynomial.pow(2);
let polynomial_cub = polynomial.pow(3);
assert_eq!(polynomial.clone() * polynomial.clone(), polynomial_sqr);
assert_eq!(polynomial_sqr.clone() * polynomial.clone(), polynomial_cub);
Source§

impl<N> SparsePolynomial<N>
where N: Copy + Zero + Neg<Output = N> + Sub<Output = N> + SubAssign + Mul<Output = N> + Div<Output = N> + AddAssign,

Source

pub fn div_mod( &self, rhs: &SparsePolynomial<N>, ) -> (SparsePolynomial<N>, SparsePolynomial<N>)

Divides self by the given SparsePolynomial, and returns the quotient and remainder.

§Example
use rustnomial::SparsePolynomial;
let polynomial = SparsePolynomial::from(vec![1.0, 2.0]);

Trait Implementations§

Source§

impl<N> Add for SparsePolynomial<N>
where N: Copy + AddAssign,

Source§

type Output = SparsePolynomial<N>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: SparsePolynomial<N>) -> SparsePolynomial<N>

Performs the + operation. Read more
Source§

impl<N: Copy + AddAssign> AddAssign for SparsePolynomial<N>

Source§

fn add_assign(&mut self, rhs: SparsePolynomial<N>)

Performs the += operation. Read more
Source§

impl<N: Clone> Clone for SparsePolynomial<N>

Source§

fn clone(&self) -> SparsePolynomial<N>

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<N: Debug> Debug for SparsePolynomial<N>

Source§

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

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

impl<N> Derivable<N> for SparsePolynomial<N>
where N: Zero + TryFromUsizeExact + Copy + Mul<Output = N>,

Source§

fn derivative(&self) -> SparsePolynomial<N>

Returns the derivative of the SparsePolynomial.

§Example
use rustnomial::{SparsePolynomial, Derivable};
let polynomial = SparsePolynomial::from(vec![4, 1, 5]);
assert_eq!(SparsePolynomial::from(vec![8, 1]), polynomial.derivative());
§Errors

Will panic if a term has a degree which does not have a lossless representation in N.

Source§

impl<N> Display for SparsePolynomial<N>
where N: Zero + One + IsPositive + PartialEq + Abs + Copy + IsNegativeOne + Display,

Source§

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

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

impl<N> Div<N> for SparsePolynomial<N>
where N: Copy + Div<Output = N>,

Source§

type Output = SparsePolynomial<N>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: N) -> SparsePolynomial<N>

Performs the / operation. Read more
Source§

impl<N> DivAssign<N> for SparsePolynomial<N>
where N: Copy + DivAssign,

Source§

fn div_assign(&mut self, rhs: N)

Performs the /= operation. Read more
Source§

impl<N> Evaluable<N> for SparsePolynomial<N>
where N: Zero + PowUsize + Copy + AddAssign + Mul<Output = N>,

Source§

fn eval(&self, point: N) -> N

Evaluates self at point, and returns the result.
Source§

impl<N> FreeSizePolynomial<N> for SparsePolynomial<N>
where N: Zero + Copy + AddAssign,

Source§

fn from_terms(terms: &[(N, usize)]) -> Self

Returns a SparsePolynomial with the corresponding terms.

§Arguments
  • terms - A slice of (coefficient, degree) pairs.
§Example
use rustnomial::{SparsePolynomial, FreeSizePolynomial};
// Corresponds to 1.0x^2 + 4.0x + 4.0
let polynomial = SparsePolynomial::from_terms(&[(1.0, 2), (4.0, 1), (4.0, 1)]);
Source§

fn add_term(&mut self, coeff: N, degree: usize)

Adds the term with given coefficient coeff and degree degree to self.
Source§

impl From<SparsePolynomial<f32>> for SparsePolynomial<f64>

Source§

fn from(item: SparsePolynomial<f32>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<i16>> for SparsePolynomial<f32>

Source§

fn from(item: SparsePolynomial<i16>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<i16>> for SparsePolynomial<f64>

Source§

fn from(item: SparsePolynomial<i16>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<i16>> for SparsePolynomial<i128>

Source§

fn from(item: SparsePolynomial<i16>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<i16>> for SparsePolynomial<i32>

Source§

fn from(item: SparsePolynomial<i16>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<i16>> for SparsePolynomial<i64>

Source§

fn from(item: SparsePolynomial<i16>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<i32>> for SparsePolynomial<f64>

Source§

fn from(item: SparsePolynomial<i32>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<i32>> for SparsePolynomial<i128>

Source§

fn from(item: SparsePolynomial<i32>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<i32>> for SparsePolynomial<i64>

Source§

fn from(item: SparsePolynomial<i32>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<i64>> for SparsePolynomial<i128>

Source§

fn from(item: SparsePolynomial<i64>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<i8>> for SparsePolynomial<f32>

Source§

fn from(item: SparsePolynomial<i8>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<i8>> for SparsePolynomial<f64>

Source§

fn from(item: SparsePolynomial<i8>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<i8>> for SparsePolynomial<i128>

Source§

fn from(item: SparsePolynomial<i8>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<i8>> for SparsePolynomial<i16>

Source§

fn from(item: SparsePolynomial<i8>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<i8>> for SparsePolynomial<i32>

Source§

fn from(item: SparsePolynomial<i8>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<i8>> for SparsePolynomial<i64>

Source§

fn from(item: SparsePolynomial<i8>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u16>> for SparsePolynomial<f32>

Source§

fn from(item: SparsePolynomial<u16>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u16>> for SparsePolynomial<f64>

Source§

fn from(item: SparsePolynomial<u16>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u16>> for SparsePolynomial<i128>

Source§

fn from(item: SparsePolynomial<u16>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u16>> for SparsePolynomial<i32>

Source§

fn from(item: SparsePolynomial<u16>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u16>> for SparsePolynomial<i64>

Source§

fn from(item: SparsePolynomial<u16>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u16>> for SparsePolynomial<u128>

Source§

fn from(item: SparsePolynomial<u16>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u16>> for SparsePolynomial<u32>

Source§

fn from(item: SparsePolynomial<u16>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u16>> for SparsePolynomial<u64>

Source§

fn from(item: SparsePolynomial<u16>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u32>> for SparsePolynomial<f64>

Source§

fn from(item: SparsePolynomial<u32>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u32>> for SparsePolynomial<i128>

Source§

fn from(item: SparsePolynomial<u32>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u32>> for SparsePolynomial<i64>

Source§

fn from(item: SparsePolynomial<u32>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u32>> for SparsePolynomial<u128>

Source§

fn from(item: SparsePolynomial<u32>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u32>> for SparsePolynomial<u64>

Source§

fn from(item: SparsePolynomial<u32>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u64>> for SparsePolynomial<i128>

Source§

fn from(item: SparsePolynomial<u64>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u64>> for SparsePolynomial<u128>

Source§

fn from(item: SparsePolynomial<u64>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u8>> for SparsePolynomial<f32>

Source§

fn from(item: SparsePolynomial<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u8>> for SparsePolynomial<f64>

Source§

fn from(item: SparsePolynomial<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u8>> for SparsePolynomial<i128>

Source§

fn from(item: SparsePolynomial<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u8>> for SparsePolynomial<i16>

Source§

fn from(item: SparsePolynomial<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u8>> for SparsePolynomial<i32>

Source§

fn from(item: SparsePolynomial<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u8>> for SparsePolynomial<i64>

Source§

fn from(item: SparsePolynomial<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u8>> for SparsePolynomial<u128>

Source§

fn from(item: SparsePolynomial<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u8>> for SparsePolynomial<u16>

Source§

fn from(item: SparsePolynomial<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u8>> for SparsePolynomial<u32>

Source§

fn from(item: SparsePolynomial<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<SparsePolynomial<u8>> for SparsePolynomial<u64>

Source§

fn from(item: SparsePolynomial<u8>) -> Self

Converts to this type from the input type.
Source§

impl<N> From<Vec<N>> for SparsePolynomial<N>
where N: Copy + Zero,

Source§

fn from(term_vec: Vec<N>) -> Self

Returns a SparsePolynomial with the corresponding terms, in order of ax^n + bx^(n-1) + … + cx + d

§Arguments
  • term_vec - A vector of constants, in decreasing order of degree.
§Example
use rustnomial::SparsePolynomial;
// Corresponds to 1.0x^2 + 4.0x + 4.0
let polynomial = SparsePolynomial::from(vec![1.0, 4.0, 4.0]);
Source§

impl<N> FromStr for SparsePolynomial<N>
where N: Zero + One + Copy + SubAssign + AddAssign + FromStr + CanNegate,

Source§

type Err = PolynomialFromStringError

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<N> Integrable<N, SparsePolynomial<N>> for Monomial<N>
where N: Zero + Copy + Mul<Output = N> + AddAssign + PowUsize + Div<Output = N> + TryFromUsizeExact,

Source§

fn integral(&self) -> Integral<N, SparsePolynomial<N>>

Returns the integral of the Monomial.

§Example
use rustnomial::{Monomial, SparsePolynomial, Integrable, FreeSizePolynomial};
let monomial = Monomial::new(3.0, 2);
let integral = monomial.integral();
assert_eq!(&SparsePolynomial::from_terms(&[(1.0, 3)]), integral.inner());
assert_eq!(1., integral.eval(0., 1.));
Source§

impl<N> Integrable<N, SparsePolynomial<N>> for SparsePolynomial<N>
where N: PartialEq + Zero + Copy + Div<Output = N> + Mul<Output = N> + PowUsize + AddAssign + TryFromUsizeExact,

Source§

fn integral(&self) -> Integral<N, SparsePolynomial<N>>

Returns the integral of the Polynomial.

§Example
use rustnomial::{SparsePolynomial, Integrable};
let polynomial = SparsePolynomial::from(vec![1.0, 2.0, 5.0]);
let integral = polynomial.integral();
assert_eq!(&SparsePolynomial::from(vec![1.0/3.0, 1.0, 5.0, 0.0]), integral.inner());
§Errors

Will panic if a term has a degree, which when incremented by one, does not have a lossless representation in N.

Source§

impl<N> Mul<&SparsePolynomial<N>> for SparsePolynomial<N>
where N: Mul<Output = N> + AddAssign + Copy + Zero,

Source§

type Output = SparsePolynomial<N>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &SparsePolynomial<N>) -> SparsePolynomial<N>

Performs the * operation. Read more
Source§

impl<N: Copy + Mul<Output = N>> Mul<N> for SparsePolynomial<N>

Source§

type Output = SparsePolynomial<N>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: N) -> SparsePolynomial<N>

Performs the * operation. Read more
Source§

impl<N> Mul for SparsePolynomial<N>
where N: Mul<Output = N> + AddAssign + Copy + Zero,

Source§

type Output = SparsePolynomial<N>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SparsePolynomial<N>) -> SparsePolynomial<N>

Performs the * operation. Read more
Source§

impl<N> MulAssign<&SparsePolynomial<N>> for SparsePolynomial<N>
where N: Mul<Output = N> + AddAssign + Copy + Zero,

Source§

fn mul_assign(&mut self, rhs: &SparsePolynomial<N>)

Performs the *= operation. Read more
Source§

impl<N: Copy + MulAssign> MulAssign<N> for SparsePolynomial<N>

Source§

fn mul_assign(&mut self, rhs: N)

Performs the *= operation. Read more
Source§

impl<N> MulAssign for SparsePolynomial<N>
where N: Mul<Output = N> + AddAssign + Copy + Zero,

Source§

fn mul_assign(&mut self, rhs: SparsePolynomial<N>)

Performs the *= operation. Read more
Source§

impl<N> MutablePolynomial<N> for SparsePolynomial<N>
where N: Zero + Copy + AddAssign + SubAssign + CanNegate,

Source§

fn try_add_term(&mut self, coeff: N, degree: usize) -> Result<(), TryAddError>

Tries to add the term with given coefficient and degree to self, returning an error if the particular term can not be added to self without violating constraints. Read more
Source§

fn try_sub_term(&mut self, coeff: N, degree: usize) -> Result<(), TryAddError>

Tries to subtract the term with given coefficient and degree from self, returning an error if the particular term can not be subtracted from self without violating constraints. Read more
Source§

impl<N> Neg for SparsePolynomial<N>
where N: Zero + Copy + Neg<Output = N>,

Source§

type Output = SparsePolynomial<N>

The resulting type after applying the - operator.
Source§

fn neg(self) -> SparsePolynomial<N>

Performs the unary - operation. Read more
Source§

impl<N> PartialEq for SparsePolynomial<N>
where N: Zero + PartialEq + Copy,

Source§

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

Returns true if self has the same terms as other.

§Example
use rustnomial::SparsePolynomial;
let a = SparsePolynomial::from(vec![1.0, 2.0]);
let b = SparsePolynomial::from(vec![2.0, 2.0]);
let c = SparsePolynomial::from(vec![1.0, 0.0]);
assert_ne!(a, b);
assert_ne!(a, c);
assert_eq!(a, b - c);
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<N> Rem for SparsePolynomial<N>
where N: Copy + Zero + Neg<Output = N> + Sub<Output = N> + SubAssign + Mul<Output = N> + Div<Output = N> + AddAssign,

Source§

fn rem(self, rhs: SparsePolynomial<N>) -> SparsePolynomial<N>

Returns the remainder of dividing self by rhs.

Source§

type Output = SparsePolynomial<N>

The resulting type after applying the % operator.
Source§

impl<N> RemAssign for SparsePolynomial<N>
where N: Copy + Zero + Neg<Output = N> + Sub<Output = N> + SubAssign + Mul<Output = N> + Div<Output = N> + AddAssign,

Source§

fn rem_assign(&mut self, rhs: SparsePolynomial<N>)

Assign the remainder of dividing self by rhs to self.

Source§

impl<N: Copy> Shl<i32> for SparsePolynomial<N>

Source§

type Output = SparsePolynomial<N>

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

fn shl(self, rhs: i32) -> SparsePolynomial<N>

Performs the << operation. Read more
Source§

impl<N: Copy> ShlAssign<i32> for SparsePolynomial<N>

Source§

fn shl_assign(&mut self, rhs: i32)

Performs the <<= operation. Read more
Source§

impl<N: Copy> Shr<i32> for SparsePolynomial<N>

Source§

type Output = SparsePolynomial<N>

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

fn shr(self, rhs: i32) -> SparsePolynomial<N>

Performs the >> operation. Read more
Source§

impl<N: Copy> ShrAssign<i32> for SparsePolynomial<N>

Source§

fn shr_assign(&mut self, rhs: i32)

Performs the >>= operation. Read more
Source§

impl<N: Zero + Copy> SizedPolynomial<N> for SparsePolynomial<N>

Source§

fn degree(&self) -> Degree

Returns the degree of the SparsePolynomial it is called on, corresponding to the largest non-zero term.

§Example
use rustnomial::{SizedPolynomial, SparsePolynomial, Degree};
let polynomial = SparsePolynomial::from(vec![1.0, 4.0, 4.0]);
assert_eq!(Degree::Num(2), polynomial.degree());
Source§

fn zero() -> SparsePolynomial<N>

Returns a SparsePolynomial with no terms.

§Example
use rustnomial::{SizedPolynomial, SparsePolynomial};
let zero = SparsePolynomial::<i32>::zero();
assert!(zero.is_zero());
assert!(zero.ordered_term_iter().next().is_none());
assert!(zero.terms.is_empty());
Source§

fn set_to_zero(&mut self)

Sets self to zero.

§Example
use rustnomial::{SparsePolynomial, SizedPolynomial};
let mut non_zero = SparsePolynomial::from(vec![0, 1]);
assert!(!non_zero.is_zero());
non_zero.set_to_zero();
assert!(non_zero.is_zero());
Source§

fn term_with_degree(&self, degree: usize) -> Term<N>

Returns the term with the given degree from self. If the term degree is larger than the actual degree, ZeroTerm will be returned. However, terms which are zero will also be returned as ZeroTerm, so this does not indicate that the final term has been reached.
Source§

fn terms_as_vec(&self) -> Vec<(N, usize)>

Returns a Vec containing all of the terms of self, where each item is the coefficient and degree of each non-zero term, in order of descending degree. Read more
Source§

fn is_zero(&self) -> bool

Returns true if all terms of self are zero, and false if a non-zero term exists. Read more
Source§

impl<N> Sub<Polynomial<N>> for SparsePolynomial<N>
where N: Zero + Copy + Sub<Output = N> + SubAssign + Neg<Output = N>,

Source§

type Output = SparsePolynomial<N>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Polynomial<N>) -> SparsePolynomial<N>

Performs the - operation. Read more
Source§

impl<N> Sub for SparsePolynomial<N>
where N: Zero + Copy + Sub<Output = N> + SubAssign + Neg<Output = N>,

Source§

type Output = SparsePolynomial<N>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: SparsePolynomial<N>) -> SparsePolynomial<N>

Performs the - operation. Read more
Source§

impl<N> SubAssign for SparsePolynomial<N>
where N: Neg<Output = N> + Sub<Output = N> + SubAssign + Copy,

Source§

fn sub_assign(&mut self, rhs: SparsePolynomial<N>)

Performs the -= operation. Read more

Auto Trait Implementations§

§

impl<N> Freeze for SparsePolynomial<N>

§

impl<N> RefUnwindSafe for SparsePolynomial<N>
where N: RefUnwindSafe,

§

impl<N> Send for SparsePolynomial<N>
where N: Send,

§

impl<N> Sync for SparsePolynomial<N>
where N: Sync,

§

impl<N> Unpin for SparsePolynomial<N>

§

impl<N> UnwindSafe for SparsePolynomial<N>
where N: RefUnwindSafe,

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, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,