GetCoefficient

Trait GetCoefficient 

Source
pub trait GetCoefficient<T> {
    // Required method
    unsafe fn get_coeff_unchecked(&self, index: i64) -> T;

    // Provided method
    fn get_coeff(
        &self,
        index: impl TryInto<i64> + Display,
    ) -> Result<T, MathError> { ... }
}
Expand description

Is implemented by polynomials to get a coefficient.

Required Methods§

Source

unsafe fn get_coeff_unchecked(&self, index: i64) -> T

Returns a coefficient of the given object, e.g. a polynomial, for a given index.

Parameters:

  • index: the index of the coefficient

Returns the coefficient of the polynomial.

§Safety

To use this function safely, make sure that the selected index is greater or equal than 0.

Provided Methods§

Source

fn get_coeff(&self, index: impl TryInto<i64> + Display) -> Result<T, MathError>

Returns a coefficient of the given object, e.g. a polynomial, for a given index.

Parameters:

  • index: the index of the coefficient
§Errors and Failures
  • Returns a MathError of type OutOfBounds if either the index is negative or does not fit into an i64.
  • Returns a MathError of type MismatchingModulus if the base types are not compatible. This can only happen if the base types themselves can mismatch.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§