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§
Sourceunsafe fn get_coeff_unchecked(&self, index: i64) -> T
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§
Sourcefn get_coeff(&self, index: impl TryInto<i64> + Display) -> Result<T, MathError>
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
MathErrorof typeOutOfBoundsif either the index is negative or does not fit into ani64. - Returns a
MathErrorof typeMismatchingModulusif 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.